From 79682398915f939e4571ff2332aadced02ad41c8 Mon Sep 17 00:00:00 2001 From: Kirthi Krishnamraju Date: Wed, 20 May 2015 23:40:16 -0700 Subject: [PATCH] React to aspnet/Configuration #195,#198 --- src/MusicStore.Spa/Startup.cs | 6 +++--- src/MusicStore.Spa/project.json | 5 +++-- src/MusicStore/Models/SampleData.cs | 4 ++-- src/MusicStore/Program.cs | 4 ++-- src/MusicStore/Startup.cs | 4 ++-- src/MusicStore/StartupNtlmAuthentication.cs | 4 ++-- src/MusicStore/StartupOpenIdConnect.cs | 4 ++-- src/MusicStore/project.json | 4 +++- .../compiler/shared/Mocks/StartupOpenIdConnectTesting.cs | 4 ++-- test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs | 4 ++-- test/E2ETests/project.json | 1 + 11 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/MusicStore.Spa/Startup.cs b/src/MusicStore.Spa/Startup.cs index 9557d33137..82849a2638 100644 --- a/src/MusicStore.Spa/Startup.cs +++ b/src/MusicStore.Spa/Startup.cs @@ -3,7 +3,7 @@ using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Runtime; using MusicStore.Apis; @@ -15,12 +15,12 @@ namespace MusicStore.Spa { public Startup(IApplicationEnvironment env) { - Configuration = new Configuration(env.ApplicationBasePath) + Configuration = new ConfigurationSection(env.ApplicationBasePath) .AddJsonFile("Config.json") .AddEnvironmentVariables(); } - public Microsoft.Framework.ConfigurationModel.IConfiguration Configuration { get; set; } + public Microsoft.Framework.Configuration.IConfiguration Configuration { get; set; } public void ConfigureServices(IServiceCollection services) { diff --git a/src/MusicStore.Spa/project.json b/src/MusicStore.Spa/project.json index e23b90eeb4..0910a20031 100644 --- a/src/MusicStore.Spa/project.json +++ b/src/MusicStore.Spa/project.json @@ -33,8 +33,9 @@ "EntityFramework.SqlServer": "7.0.0-*", "Microsoft.AspNet.Authentication.Cookies": "1.0.0-*", "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*", - "Microsoft.Framework.ConfigurationModel": "1.0.0-*", - "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*", + "Microsoft.Framework.Configuration": "1.0.0-*", + "Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*", + "Microsoft.Framework.Configuration.Json": "1.0.0-*", "AutoMapper": "4.0.0-ci1026" }, "commands": { diff --git a/src/MusicStore/Models/SampleData.cs b/src/MusicStore/Models/SampleData.cs index 122629b142..8f378ffe07 100644 --- a/src/MusicStore/Models/SampleData.cs +++ b/src/MusicStore/Models/SampleData.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Identity; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Relational; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Runtime; @@ -89,7 +89,7 @@ namespace MusicStore.Models { var appEnv = serviceProvider.GetService(); - var configuration = new Configuration(appEnv.ApplicationBasePath) + var configuration = new ConfigurationSection(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); diff --git a/src/MusicStore/Program.cs b/src/MusicStore/Program.cs index 62aeff789d..5d7550f1cf 100644 --- a/src/MusicStore/Program.cs +++ b/src/MusicStore/Program.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNet.Hosting; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; namespace MusicStore { @@ -21,7 +21,7 @@ namespace MusicStore public Task Main(string[] args) { //Add command line configuration source to read command line parameters. - var config = new Configuration(); + var config = new ConfigurationSection(); config.AddCommandLine(args); using (new WebHostBuilder(_serviceProvider, config) diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index 1b0b02dc12..a750693ac4 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -6,7 +6,7 @@ using Microsoft.AspNet.Diagnostics.Entity; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; using Microsoft.Framework.Caching.Memory; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; using Microsoft.Framework.Runtime; @@ -23,7 +23,7 @@ namespace MusicStore { //Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources, //then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely. - Configuration = new Configuration(env.ApplicationBasePath) + Configuration = new ConfigurationSection(env.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values. diff --git a/src/MusicStore/StartupNtlmAuthentication.cs b/src/MusicStore/StartupNtlmAuthentication.cs index 19276f0c23..33c0fde62f 100644 --- a/src/MusicStore/StartupNtlmAuthentication.cs +++ b/src/MusicStore/StartupNtlmAuthentication.cs @@ -7,7 +7,7 @@ using Microsoft.AspNet.Diagnostics.Entity; using Microsoft.AspNet.Server.WebListener; using Microsoft.Data.Entity; using Microsoft.Framework.Caching.Memory; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; using Microsoft.Framework.Runtime; @@ -36,7 +36,7 @@ namespace MusicStore { //Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources, //then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely. - Configuration = new Configuration(env.ApplicationBasePath) + Configuration = new ConfigurationSection(env.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values. } diff --git a/src/MusicStore/StartupOpenIdConnect.cs b/src/MusicStore/StartupOpenIdConnect.cs index 9e0a1f971e..08665c5eea 100644 --- a/src/MusicStore/StartupOpenIdConnect.cs +++ b/src/MusicStore/StartupOpenIdConnect.cs @@ -6,7 +6,7 @@ using Microsoft.AspNet.Diagnostics.Entity; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; using Microsoft.Framework.Caching.Memory; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; using Microsoft.Framework.Runtime; @@ -36,7 +36,7 @@ namespace MusicStore { //Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources, //then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely. - Configuration = new Configuration(env.ApplicationBasePath) + Configuration = new ConfigurationSection(env.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values. diff --git a/src/MusicStore/project.json b/src/MusicStore/project.json index e52c0e3f38..ced6dd0492 100644 --- a/src/MusicStore/project.json +++ b/src/MusicStore/project.json @@ -33,7 +33,9 @@ "Microsoft.AspNet.Tooling.Razor": "1.0.0-*", "Microsoft.Framework.Caching.Distributed": "1.0.0-*", "Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-*", - "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*", + "Microsoft.Framework.Configuration.CommandLine": "1.0.0-*", + "Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*", + "Microsoft.Framework.Configuration.Json": "1.0.0-*", "Microsoft.Framework.Logging.Console": "1.0.0-*" }, "commands": { diff --git a/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs b/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs index 58ae99e3b9..9cea3a2dd6 100644 --- a/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs +++ b/test/E2ETests/compiler/shared/Mocks/StartupOpenIdConnectTesting.cs @@ -8,7 +8,7 @@ using Microsoft.AspNet.Diagnostics.Entity; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; using Microsoft.Framework.Caching.Memory; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; using Microsoft.Framework.Runtime; @@ -27,7 +27,7 @@ namespace MusicStore { //Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources, //then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely. - Configuration = new Configuration(env.ApplicationBasePath) + Configuration = new ConfigurationSection(env.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values. diff --git a/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs b/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs index 25bb31c523..28da6a0025 100644 --- a/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs +++ b/test/E2ETests/compiler/shared/Mocks/StartupSocialTesting.cs @@ -11,7 +11,7 @@ using Microsoft.AspNet.Diagnostics.Entity; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; using Microsoft.Framework.Caching.Memory; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Logging; using Microsoft.Framework.Runtime; @@ -33,7 +33,7 @@ namespace MusicStore { //Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources, //then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely. - Configuration = new Configuration(appEnvironment.ApplicationBasePath) + Configuration = new ConfigurationSection(appEnvironment.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables() //All environment variables in the process's context flow in as configuration values. .AddJsonFile("configoverride.json", optional: true); // Used to override some configuration parameters that cannot be overridden by environment. diff --git a/test/E2ETests/project.json b/test/E2ETests/project.json index c6fbcc4ba7..cd9952b69e 100644 --- a/test/E2ETests/project.json +++ b/test/E2ETests/project.json @@ -10,6 +10,7 @@ "Microsoft.AspNet.Server.Testing": "1.0.0-*", "Microsoft.AspNet.SignalR.Client": "2.1.1", "Microsoft.AspNet.WebUtilities": "1.0.0-*", + "Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*", "Microsoft.Framework.Logging.Console": "1.0.0-*", "xunit.runner.aspnet": "2.0.0-aspnet-*" },