2025-02-11 23:10:43 +01:00
|
|
|
|
namespace Core.Configurations.SmartConfig
|
2025-02-02 23:13:17 +01:00
|
|
|
|
{
|
|
|
|
|
|
public static class SmartConfigExtension
|
|
|
|
|
|
{
|
2025-02-11 19:34:45 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="builder"></param>
|
|
|
|
|
|
/// <param name="configKey">Name of key</param>
|
|
|
|
|
|
/// <param name="path">If this is different than the default ConnectionStrings-element, then configure it.</param>
|
|
|
|
|
|
/// <returns></returns>
|
2025-02-02 23:13:17 +01:00
|
|
|
|
public static IConfigurationBuilder AddSmartConfig(this IConfigurationBuilder builder, string configKey = "DefaultConnection", string path = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return builder.AddProvider(new SmartConfigProvider(builder, configKey, path));
|
|
|
|
|
|
}
|
2025-02-11 18:46:51 +01:00
|
|
|
|
public static IConfigurationBuilder AddSmartConfig(this IConfigurationBuilder builder, Action<SmartConfigOptions> setupAction)
|
|
|
|
|
|
{
|
|
|
|
|
|
var options = new SmartConfigOptions();
|
|
|
|
|
|
setupAction(options);
|
|
|
|
|
|
|
2025-02-11 23:10:43 +01:00
|
|
|
|
return builder.AddProvider(new SmartConfigProvider(builder, options));
|
2025-02-02 23:13:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|