PlanTempusApp/PlanTempus.Core/Configurations/SmartConfigProvider/SmartConfigOptions.cs

45 lines
1.9 KiB
C#
Raw Normal View History

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
{
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;
_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>
public SmartConfigOptions UseRepository(IConfigurationRepository repository)
2025-02-11 23:10:43 +01:00
{
_repository = repository;
return this;
}
internal IConfigurationRepository GetRepository() => _repository;
2025-02-11 23:10:43 +01:00
}
}