Skip to content

Instantly share code, notes, and snippets.

@configureappio
Created March 28, 2018 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save configureappio/6558f9776ae60aa3f1d888072a37cc12 to your computer and use it in GitHub Desktop.
Save configureappio/6558f9776ae60aa3f1d888072a37cc12 to your computer and use it in GitHub Desktop.
Example of changes required to Startup.cs to use the reader for the configuration mapping and the bridge as the implementation used by controller
public class Startup
{
// Other methods omitted for brevity in example
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddOptions();
// use the reader class to map the configuration
services.Configure<MyAppSettingsReader>(Configuration.GetSection("MyAppSettings"));
// but use the bridge class as the implementation of IMyAppSettings
services.AddTransient<IMyAppSettings, MyAppSettingsBridge>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment