I have an ASP.NET 5 MVC Web Application and in Startup.cs I see that the public property
IConfigurationRoot Configuration
is being set to
I have a constructor in my repository class that accepts the db connection string as a parameter. This works for me when I add my repository for injection. In ConfigureServies() of the startup.cs file add this:
services.AddScoped(c => new Repos(Configuration["DbConnections:ConnStr1"]));
IRepos.cs
is the interface, Repos.cs
is the class that implements it. And of course Configuration is just a reference to the built IConfigurationRoot
object.