Using an ASP.Net Core 2 Web App to call Full a library using EF6

.net .net-4.7 asp.net-core asp.net-core-2.0 entity-framework-6

Accepted Answer

You should re-target the programme against.Net Framework if you wish to use an Entity Framework library from a.Net Core application. This is what a reputable source said:

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.

You can tell that it targets.Net Framework, not.Net Core, by looking at a sample.Net.Core project (linked from the same article) that utilises a library with EF6 (exactly your situation):

<TargetFramework>net452</TargetFramework>

You won't lose any of the.Net Core features you are presently utilising while doing such retargeting. You may still utilise the delicious features of.Net Core. However, you only allow the.Net Framework to be used as a launch platform for your application. Unfortunately, there is presently no way to get around this restriction since Entity Framework is only available for the.Net Framework. Either go toward Entity Framework Core or wait till Entity Framework will take on the role of.Net Standard are your alternatives.

In conclusion, modify the following line in your.Net Core csproj file to resolve your present issue:

<TargetFramework>netcoreapp2.0</TargetFramework>

to

<TargetFramework>net47</TargetFramework>
3
3/16/2018 2:10:07 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow