Hello, everyone.
I basically have a data access layer with EF6 and a presentation layer (Asp.Net WebApi). I am not able to make it work without the presentation layer referring to EF. Does anyone know how to solve this?
My solution is currently like this:
Core - sem dependências
Domain - depende da Core
DataAccess - depende da Core, Domain e EF
WebApi - depende da Core, Domain e DataAccess (e EF, mas não deveria)
There is no public class in DataAccess that exposes some EF dependency (DbContext, DbSet, etc). Instead, there is a set of own façade classes.
Without any reference, this exception occurs in the first line of code that accesses the data:
[System.InvalidOperationException]
No Entity Framework provider found for the ADO.NET provider with invariant name
'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework'
section of the application config file.
See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Adding the EF section in Web.config (but without EF referencing), this other exception occurs immediately in DbContext instantiation:
[System.InvalidOperationException]
The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
registered in the application config file for the ADO.NET provider with invariant name
'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is
used and that the assembly is available to the running application.
See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.