Can I develop an Asp.net core MVC application usin

2019-07-10 04:26发布

问题:

I want to use ASP.NET Core with my new project as I heard that it's faster. However, the project will use extensive database accessing feature of which some are not supported by Entity Framework Core. I want to know, is it possible to develop an ASP.NET Core MVC application using Entity Framework 6 (not Entity Framework Core)?

回答1:

Based on the documentation of ASP.NET Core, it says:

To use Entity Framework 6, your project has to compile against the full .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.



回答2:

If you only need the speed of Net Core, you can put your Db Context class in another .Net Framework project and then add reference to that project from Net Core project.
By doing that, you can use EF 6 in Net core and also gain the speed of Net Core web project.
The drawback is you loss cross-platform features.