asp.netentity-framework.net-corespatial-data

Can I use Entity Framework 6 (not core) in .net core?


Entity Framework Core does not support spatial data, which I need to use in my app.

Can I use Entity Framework 6 in .net core? If so, how can I register DatabaseContext in Startup.cs?


Solution

  • UPDATE: Yes, EF6 has been cross-platform since version 6.3. https://devblogs.microsoft.com/dotnet/announcing-ef-core-3-0-and-ef-6-3-general-availability/#what-s-new-in-ef-6-3


    ORIGINAL ANSWER THAT IS NOW INVALID: No, you can not directly, because EF6 doesn't support .NET Core. But, you can create another project, that compiles against full .NET framework and use it as a reference.

    MS has actually made a decent tutorial for this: https://learn.microsoft.com/en-us/aspnet/core/data/entity-framework-6#reference-full-framework-and-ef6-in-the-asp-net-core-project