Reputation: 3281
I have been reading about .NET Core and ASP.NET Core and Entity Framework 6.
It states
The recommended way to use Entity Framework 6 in an ASP.NET Core application is to put the EF6 context and model classes in a class library project that targets the full framework. Add a reference to the class library from the ASP.NET Core project.
However, when I actually do the following.
It will not let me compile with the following error:
The Type DbSet is defined in an assembly that is not referenced.
This means I have to add an ADO.NET Entity Framework reference to the console application, but it will not allow me to as a .NET Core application does not support the full Entity Framework.
Surely, I am missing something or getting the post mentioned above wrong.
What is the issue?
Upvotes: 3
Views: 4008
Reputation: 30513
From Entity Framework 6.3 onward you'll be able to use EF6.x with .NET Core rather than having to switch to EF Core.
From Diego Vega's blog post Announcing Entity Framework 6.3 Preview with .NET Core Support:
What is new in EF 6.3?
While Entity Framework Core was built from the ground up to work on .NET Core, 6.3 will be the first version of EF 6 that can run on .NET Core and work cross-platform. In fact, the main goal of this release is to facilitate migrating existing applications that use EF 6 to .NET Core 3.0.
Upvotes: 3
Reputation: 7100
The link you provide is clear:
To use Entity Framework 6, your project has to compile against .NET Framework, as Entity Framework 6 doesn't support .NET Core. If you need cross-platform features you will need to upgrade to Entity Framework Core.
Create a new ASP.NET Core and target to full .NET instead of Core.
Upvotes: 2