Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Entity Framework 6 in ASP.NET Core

Let's say I have:

  • ASP.NET Core stand alone Web API project for .NET Core framework
  • Class Library with EF6 data model for full .NET framework

The ASP.NET Core project refers to the class library

This architecture proposed here:

https://docs.microsoft.com/en-us/aspnet/core/data/entity-framework-6

The question is: will my standalone application be able to execute on the specified target platform (Win, Linux, Mac runtime) after Release (or Publish), if it's dependency targets to full .NET Framework?

Thanks very much

like image 894
Ivan Avatar asked May 02 '17 20:05

Ivan


People also ask

Is Entity Framework 6 still supported?

Versions 6.0, 6.1, 6.2, and 6.3 are no longer supported. Although Entity Framework 6. x is still supported, it is no longer being developed and will only receive fixes for security issues.

Does EF core 6 require .NET 6?

EF Core 6.0 requires . NET 6.

Can we use EF in .NET core?

Entity Framework is an Object/Relational Mapping (O/RM) framework. It is an enhancement to ADO.NET that gives developers an automated mechanism for accessing & storing the data in the database. EF Core is intended to be used with . NET Core applications.

What is difference between Entity Framework 5 and 6?

EF5 is built into the core of . NET 4.5, whereas EF6 has been shifted out, and is open source. This means that you must add the new EF6 assemblies to all of the relevant projects in the solution, in particular the entry project. This means that you must remove assembly System.


1 Answers

It will be not possible. The same link you provided confirm that:

To use Entity Framework 6, your project has to compile against .NET Framework, as Entity Framework 6 does not support .NET Core. If you need cross-platform features you will need to upgrade to Entity Framework Core.

You can use ASP.NET Core upon .NET Framework (Not .NET CORE) and EF6 (But not cross-platform). But not ASP.NET Core upon .NET Core and use EF6. You will need to use EF Core for that project.

like image 81
Adailson De Castro Avatar answered Oct 03 '22 03:10

Adailson De Castro