Beispiel #1
0
        public static IConfigurationBuilder AddConfigurationManager(this IConfigurationBuilder builder, bool optional, bool reloadOnChange)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.AddConfigurationManager(source => {
                source.Path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath;
                source.Optional = optional;
                source.ReloadOnChange = reloadOnChange;
                source.ResolveFileProvider();
            }));
        }
Beispiel #2
0
 /// <summary>
 /// Adds the settings from the current application's App.config or Web.config to the
 /// specified configuration builder. Settings from <see cref="ConfigurationManager.AppSettings"/>
 /// along with any custom sections of type <see cref="RockLibConfigurationSection"/> will be added.
 /// </summary>
 /// <param name="builder">The <see cref="IConfigurationBuilder"/> to add to.</param>
 /// <returns>The <see cref="IConfigurationBuilder"/></returns>
 public static IConfigurationBuilder AddConfigurationManager(this IConfigurationBuilder builder) =>
 builder.AddConfigurationManager(DefaultReloadOnChange);