So I'm trying to seperate concerns of my project and properly isolate layers. Therefore the layers I have are:
Web
,
Domain
and Data
I've noticed from several answers on S/O that the best designs are especially when the data access is not known and is self contained in the data layer. Since with this approach I need to DI the DbContext in my Web
project, however this exposes that the Data
layer is using EntityFrameworkCore
to the Web
project like so:
Startup:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(option =>
option.UseSqlServer(_configuration.GetConnectionString("Data")));
}
Is there any way to just DI this in the Data
project thus hiding what the Data
layer is using from the Web
project?