So I am building a REST API in .Net core with the following architecture and I'm wondering how to reference Entity Framework Core.
These are three projects, referencing each other the way it's shown on the image. All the queries are stored in DAL (Data Layer), so this is where I defined DbContext.
But at the same time, I also need to add DbContext to the ConfigureServices on WebAPI Startup (
So the main issue is, is that I cannot access DbContext in WebAPI, because WebAPI doesn't directly reference DAL.
I would appreciate very much any tips, suggestions or workarounds, that wouldn't impact the architecture in any major ways.
Add the DAL project as reference to the WebApi project, from there you can get access to DbContext, to access the queries of DAl from WebApi you need to used the repository pattern. Here is a nice medium article on build a multi layer Asp.Net Core project