Example #1
0
 /// <summary>
 /// Uses system environment variables
 /// </summary>
 public static ConfigurationBuilder <TInterface> UseEnvironmentVariables <TInterface>(this ConfigurationBuilder <TInterface> builder) where TInterface : class
 {
     builder.UseConfigStore(new EnvironmentVariablesStore());
     return(builder);
 }
Example #2
0
 /// <summary>
 /// Simple INI storage.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="iniFilePath">File does not have to exist, however it will be created as soon as you try to write to it.</param>
 /// <returns></returns>
 public static ConfigurationBuilder <TInterface> UseIniFile <TInterface>(this ConfigurationBuilder <TInterface> builder, string iniFilePath) where TInterface : class
 {
     builder.UseConfigStore(new IniFileConfigStore(iniFilePath));
     return(builder);
 }
Example #3
0
 /// <summary>
 /// Reads builder from the .dll.config or .exe.config file.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="assembly">Reference to the assembly to look for</param>
 /// <returns></returns>
 public static ConfigurationBuilder <TInterface> UseAssemblyConfig <TInterface>(this ConfigurationBuilder <TInterface> builder, Assembly assembly) where TInterface : class
 {
     builder.UseConfigStore(new AssemblyConfigStore(assembly));
     return(builder);
 }
Example #4
0
 /// <summary>
 /// Standard app.config (web.config) builder custom configuration section store. Read-only.
 /// </summary>
 public static ConfigurationBuilder <TInterface> UseAppConfigSection <TInterface>(this ConfigurationBuilder <TInterface> builder, string sectionName) where TInterface : class
 {
     builder.UseConfigStore(new AppConfigSectionStore(sectionName));
     return(builder);
 }
Example #5
0
 /// <summary>
 /// Standard app.config (web.config) builder store. Read-only.
 /// </summary>
 public static ConfigurationBuilder <TInterface> UseAppConfig <TInterface>(this ConfigurationBuilder <TInterface> builder) where TInterface : class
 {
     builder.UseConfigStore(new AppConfigStore());
     return(builder);
 }
 /// <summary>
 /// In-memory dictionary. Optionally you can pass pre-created dictionary, otherwise it will be created internally as empty.
 /// </summary>
 public static ConfigurationBuilder <TInterface> UseInMemoryDictionary <TInterface>(this ConfigurationBuilder <TInterface> builder,
                                                                                    IDictionary <string, string> container = null) where TInterface : class
 {
     builder.UseConfigStore(new DictionaryConfigStore(container));
     return(builder);
 }
 /// <summary>
 /// Uses JSON file as a builder storage.
 /// </summary>
 /// <param name="builder">Configuration object.</param>
 /// <param name="jsonString">Json document.</param>
 /// <returns>Changed builder.</returns>
 /// <remarks>Storage file does not have to exist, however it will be created as soon as first write performed.</remarks>
 public static ConfigurationBuilder <TInterface> UseJsonString <TInterface>(this ConfigurationBuilder <TInterface> builder, string jsonString) where TInterface : class
 {
     builder.UseConfigStore(new JsonFileConfigStore(jsonString, false));
     return(builder);
 }