Bruce idea is quite good and would be helpful. If it is possible, I would recommend going one step further to create a service layer that would interact with the BLL.
How to use EF Core in a N-Layer application
Hi !
I don't know if there is some official best practices for this, but I need a bit of help. We have an application split into 3 layers : Data Access Layer (DAL), Business Logic Layer (BLL) and Presentation Layer. In other applications, we use nHibernate, but we were asked to switch to EF Core and we struggle a bit.
With nHibernate, the DAL would return an IQueryable list and we would construct the query in the BLL. For exemple, I need to retrieve a list of objects by name, we would call the DAL to get an IQueryable list of all objects and with a Where clause Where(x => x.Name == name). With EF Core, we have to call the DbContext inside a using statement (to be sure it will be disposed correctly), so our DAL can't return us an IQueryable list, we get an error when we manipulate the collection in the BLL.
I am trying to find out if it is okay to just call the DbContext directly in the BLL instead, and all our DAL would contain would be the DbContext and migrations.
Thank you all for your help