Adds option pattern for smart config

This commit is contained in:
Janus C. H. Knudsen 2025-02-11 23:10:43 +01:00
parent 6839cd82e2
commit f4f2fc47b1
6 changed files with 130 additions and 87 deletions

View file

@ -0,0 +1,28 @@
namespace Core.Configurations.SmartConfig
{
public class SmartConfigOptions
{
private SmartConfiguration.IConfigurationRepository _repository;
internal string _configKey;
public SmartConfigOptions UsePostgres(string configKey)
{
_configKey = configKey;
_repository = new Configurations.SmartConfigProvider.Repositories.PostgresConfigurationRepository();
return this;
}
public SmartConfigOptions UseSqlServer()
{
throw new NotImplementedException();
}
public SmartConfigOptions UseRepository(SmartConfiguration.IConfigurationRepository repository)
{
_repository = repository;
return this;
}
internal SmartConfiguration.IConfigurationRepository GetRepository() => _repository;
}
}