public static T Parse <T>()
        {
            var parser = new ConfigurationParser(new EnvironmentVariableRepository(
                                                     new EnvironmentVariableSource(),
                                                     new FileVariableSource()));

            return(parser.ParseConfiguration <T>());
        }
        public static T Parse <T>(string fileName)
        {
            var parser = new ConfigurationParser(new EnvironmentVariableRepository(
                                                     new EnvironmentVariableSource(),
                                                     new FileVariableSource(ConfigurationTypeEnum.PreferEnvironment, fileName)));

            return(parser.ParseConfiguration <T>());
        }
Exemple #3
0
 private static IWebHostBuilder ConfigureService <T>(IWebHostBuilder hostBuilder, string fileName = null,
                                                     ConfigurationTypeEnum configurationType      = ConfigurationTypeEnum.PreferEnvironment)
 {
     return(hostBuilder.ConfigureServices(services =>
     {
         var configurationParser = new ConfigurationParser(configurationType, fileName);
         var instance = configurationParser.ParseConfiguration <T>();
         services.AddSingleton(typeof(T), instance);
     }));
 }
        public static T Parse <T>(IEnvironmentVariableRepository env)
        {
            var parser = new ConfigurationParser(env);

            return(parser.ParseConfiguration <T>());
        }