From 7f597b75a3d38fca8970501a138ae45800a74e53 Mon Sep 17 00:00:00 2001 From: Isaac Levin Date: Fri, 29 Sep 2017 12:01:17 -0400 Subject: [PATCH] Added documentation on adding configuration providers to 1.x to 2.0 Migration Document --- aspnetcore/migration/1x-to-2x/index.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aspnetcore/migration/1x-to-2x/index.md b/aspnetcore/migration/1x-to-2x/index.md index 99209ffa1d..ab930ff42c 100644 --- a/aspnetcore/migration/1x-to-2x/index.md +++ b/aspnetcore/migration/1x-to-2x/index.md @@ -98,6 +98,20 @@ The adoption of this new 2.0 pattern is highly recommended and is required for p ``` Unable to create an object of type ''. Add an implementation of 'IDesignTimeDbContextFactory' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time. ``` +## Adding Additional Configurations + +In 2.0 projects, the boilerplate configuration code is done behind the scenes. By default, Environment Variables and Application Settings are loaded into startup so all that is required in *Startup.cs* is initializing `IConfiguration` with the injected instance. To add additional providers, or change the existing providers, utilize `ConfigureAppConfiguration` on `IWebHostBuilder` in *Program.cs*. The setup is similar to Core 1.x + +```` + var host = new HostBuilder() + .ConfigureAppConfiguration((hostContext, config) => + { + config.AddEnvironmentVariables(); + config.AddJsonFile("appsettings.json", optional: true); + config.AddCommandLine(args); + }) +```` +