I am working a new project - and I want to do it using the latest .NET Core.
Reading through the documentation, I came across the comparison between Entity Framework Core and Entity Framework 6.x Comparison. Here
Some of the features that I require like: Spatial Data Type
is NOT supported by EF Core. So I CAN'T use it, because Spatial Data Type is required in the Project.
Going through the documentation again, I came across this link on How to use EF 6.x with .NET Core: Here
In the article it mentions (Here):
Before you start, make sure that you compile against full .NET Framework in your project.json as Entity Framework 6 does not support .NET Core. If you need cross platform features you will need to upgrade to Entity Framework Core.
I don't really need my project to be cross platform.
I created a new ASP.NET Core Web Application
then I installed EF6 using Nuget Package Manager, and got the following error
I went and removed the netcoreapp1.0
from the frameworks in project.json
and added net46
as framework, which removed the error for EF, but now I am getting another error.
So how do I use EF6 with ASP.NET core?
When I use EF6 I have to remove all references to .NET Core, does this mean I am not using .NET Core? What are the disadvantages of this other than it can't run cross platform?
To stop the second error you need to remove the following from the dependencies
section of your project.json
:
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
For reference, the documentation for referencing the full .NET Framework and Entity Framework 6 from an ASP.NET Core project has a full project.json
example.
Removing references to .NET Core does not mean you are not using ASP.NET Core. You are only changing the target runtime platform that your ASP.NET Core project will execute on.
Using ASP.NET Core with the full .NET Framework, you get the benefits of the new project structure and unified story for building web UI and web APIs (e.g. unified Controller
class), and you also gain access to the mature, fully-featured .NET Framework, enable use of dependencies and NuGet packages which haven't been ported to .NET Core, for example Entity Framework 6.