2025-02-20 00:23:13 +01:00
|
|
|
namespace PlanTempus.Core.Configurations.SmartConfigProvider
|
2025-02-11 23:10:43 +01:00
|
|
|
{
|
2025-02-11 23:32:28 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Configuration options for setting up smart configuration providers.
|
|
|
|
|
/// Provides fluent configuration methods for specifying the repository type and settings.
|
|
|
|
|
/// </summary>
|
2025-02-11 23:10:43 +01:00
|
|
|
public class SmartConfigOptions
|
|
|
|
|
{
|
2025-02-18 16:23:08 +01:00
|
|
|
private IConfigurationRepository _repository;
|
2025-02-11 23:10:43 +01:00
|
|
|
internal string _configKey;
|
|
|
|
|
|
2025-02-11 23:32:28 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Configures the smart configuration to use PostgreSQL as the configuration store.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="configKey">The configuration key used to find the connection string</param>
|
|
|
|
|
/// <returns>The configuration options instance for method chaining</returns>
|
2025-02-11 23:10:43 +01:00
|
|
|
public SmartConfigOptions UsePostgres(string configKey)
|
|
|
|
|
{
|
|
|
|
|
_configKey = configKey;
|
2025-02-18 16:23:08 +01:00
|
|
|
_repository = new Repositories.PostgresConfigurationRepository();
|
2025-02-11 23:10:43 +01:00
|
|
|
return this;
|
|
|
|
|
}
|
2025-02-11 23:32:28 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Configures the smart configuration to use SQL Server as the configuration store.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>The configuration options instance for method chaining</returns>
|
|
|
|
|
/// <exception cref="NotImplementedException">This feature is not yet implemented</exception>
|
2025-02-11 23:10:43 +01:00
|
|
|
public SmartConfigOptions UseSqlServer()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2025-02-11 23:32:28 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Configures the smart configuration to use a custom configuration repository.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="repository">The configuration repository to use</param>
|
|
|
|
|
/// <returns>The configuration options instance for method chaining</returns>
|
2025-02-18 16:23:08 +01:00
|
|
|
public SmartConfigOptions UseRepository(IConfigurationRepository repository)
|
2025-02-11 23:10:43 +01:00
|
|
|
{
|
|
|
|
|
_repository = repository;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-18 16:23:08 +01:00
|
|
|
internal IConfigurationRepository GetRepository() => _repository;
|
2025-02-11 23:10:43 +01:00
|
|
|
}
|
|
|
|
|
}
|