refactor: remove unused config service

This commit is contained in:
Oliver Booth 2023-08-12 22:38:28 +01:00
parent 58799594ae
commit 692d688dc3
Signed by: oliverbooth
GPG Key ID: B89D139977693FED

View File

@ -1,34 +0,0 @@
using Microsoft.EntityFrameworkCore;
using OliverBooth.Data;
namespace OliverBooth.Services;
/// <summary>
/// Represents a service for retrieving configuration values.
/// </summary>
public sealed class ConfigurationService
{
private readonly IDbContextFactory<WebContext> _webContextFactory;
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationService" /> class.
/// </summary>
/// <param name="webContextFactory">
/// The <see cref="IDbContextFactory{TContext}" /> for the <see cref="WebContext" />.
/// </param>
public ConfigurationService(IDbContextFactory<WebContext> webContextFactory)
{
_webContextFactory = webContextFactory;
}
/// <summary>
/// Gets the value of a site configuration key.
/// </summary>
/// <param name="key">The key of the site configuration item.</param>
/// <returns>The value of the site configuration item.</returns>
public string? GetSiteConfiguration(string key)
{
using WebContext context = _webContextFactory.CreateDbContext();
return context.SiteConfiguration.Find(key)?.Value;
}
}