Make Entityframework 6 target .NET Standard and/or work with .NET Core
On the build 2017 event @coolcsh(Scott hunter) said that 70% in nuget library compatible with dotnet standard 2.0 is EF6 will support it.
@badre429 there a few APIs EF6 uses that are either missing in .NET Standard 2.0 or in the .NET Standard version of some EF6 dependency.
The fact that 70% of all the packages in NuGet.org are API compatible with .NET Standard 2.0 is a very important metric but it does not imply that specific popular packages are compatible.
We have done some analysis of the gap, starting with a run through API Port, but we still need to discuss and understand what we can do about it (e.g. either come up with new API additions for .NET Standard 2.x or EF6 dependencies or modifying a future version of EF6 to stop using those APIs).
Once we have that data in hand, more information from customers wanting to run EF6 outside of .NET Framework can help us understand what priority we should give to this.
Keep in mind that making EF6 fully usable on projects that target other implementations of .NET than .NET Framework would also require significant changes to our migrations tooling. That is covered by https://github.com/aspnet/EntityFramework6/issues/231.
@badre429 I will be repurposing your question to track the ongoing investigation.
"I would like to encourage anyone wanting this to happen to comment in the issue pointed above with their specific reasons. This will help us prioritize." - -divega
Please, this would help me convert existing projects using EF6 to .net core.
We are running asp.net core on the full framework in 1.x and also plan to do this for the upcoming asp.net core 2.0 release. The reason for this is primarily we need EF6 for spatial. Maybe there are other blockers but spatial is the obvious one.
Would be great to run on .net core if we could, so modifying EF6 to work against net standard 2.x could be an interim solution until EF Core is ready ! :-)
Actually, we also need directory services and servicebase but these are flagged as high priority ports i believe, so hopefully later this year for them.
Agree with @jrkd. Not having to migrate off EF6 would incredibly help migrate existing projects to dotnet core.
@divega any update
What is the current state of this gap after the .NET Core 2.0 release?
We are also stuck on EF6 for several reasons (in-memory query client-side eval, group by clauses, spatial etc.). We had to downgrade from EF7 to EF6 after a really painful migration and realizing we could not handle the present EF7 limitations after a few months – would be wonderful to be able to move to .NET Core while still targeting EF6.
Is this planned at all for EF 6.2 ??
API Port report here: ApiPortAnalysis.xlsx
We are migrating our libraries to .NET Standard 2, and it would be great to have EF6 ported as well.
Same Problem here. EF Core is no option for us. If EF6 does not work with .net Standard 2.0 I have to go back to the old Framework 4.x...
Is the bulk of that 5% around the app.config piece? If that was split out into a separate project how close would we be to standard v2?
Please try to find a way to make this work. Having the real Entity Framework working on Linux will be wonderful!
@fanol you can already do that with Mono and EF6
Yes but Net Core is better that Mono already in my opinion.
Great work on the release of EF 6.2 team! (Announcement: https://blogs.msdn.microsoft.com/dotnet/2017/10/26/entity-framework-6-2-runtime-released/)
Any updates on the priority of exploring support of .NET Core for EF 6.3?
@ErikEJ Knowing that netstandard2.0 can add compatibility shims for non netstandard apis, shouldn't it be possible to run ef6 with the compatibility shims for ConfigurationManager , etc ?.
I'm trying to run ef6 on dotnet core 2.0 and fails at DBContext instantiation with
System.TypeLoadException: 'Could not load type 'System.Data.Common.DbProviderFactories' from assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.'
Looking at the modules view in VS 2017 I see that System.Data is the one from .net Core.
Why Isn't System.Data shimmed ?
We have several clients both large financial and investment houses and smaller businesses who are all remaining on 4.6.1 because of entity framework. Spacial data and TPT inheritance are the main levers stopping our migration.
If we could use EF6 on dotnetcore we would start the migration immediately.
We couldn't move to Azure Functions because EF6 doesn't work on .NET Standard 2.0.
Has anyone successfully tried having an EF 6 project and a .Net Core 2 project in the same solution with the .Net Core 2 project being able to reference and get data from the EF 6 project? I'm testing this out now and haven't been successful yet ..... I just wonder if I should keep trying or go back to older .Net editions... Thanks in advance
@twosandy - not sure exactly what you're asking - but you cannot target the .net core framework with EF6. What you can achieve though, is a .netcore web site using all the dotnet core libraries, and also include a dependency on EF6.
The web site will function correctly, but it must be hosted in a framework 4.6.1 / 4.7 (or below) full dotnet stack. You will not be able (for example) to execute it on a non windows platform.
All our web sites that have any database access use this pattern. We have multiple deployments in production that rely on the full framework, but are ASPNET CORE web sites. They will remain this way until such time as EF core catches up (a long way off - years probably, the additional inheritance patterns aren't even scheduled yet), or this issue is closed.