I wired the layer together via autofac modules. Big thanks to endeffects. Here is the HowTo. Now I'm trying to make the connection string available in the DAL layer. I tried to register the:
Configuration (Microsoft.Extensions.Configuration)
From the Startup class but without any success.
I have the following line in my ConfigureServices method in startup.cs:
services.AddSingleton(serviceType => Configuration);
services.AddInstance<Microsoft.Extensions.Configuration.IConfiguration>(Configuration);
builder.Populate(services);
var container = builder.Build();
var serviceProvider = container.Resolve<IServiceProvider>();
return serviceProvider;
Then in my DAL, I access that via constructor injections like:
public MyDataContext(IConfiguration configurations)
I can then access that item and pull my connection info like:
configurations["Data:MyConnection:ConnectionString"]