[英]Can I develop an Asp.net core MVC application using Entity Framework 6 (not Entity Framework core)?
I want to use ASP.NET Core
with my new project as I heard that it's faster. 我想在我的新项目中使用
ASP.NET Core
,因为我听说它更快。 However, the project will use extensive database accessing feature of which some are not supported by Entity Framework Core
. 但是,该项目将使用广泛的数据库访问功能,其中一些功能不受
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
)? 我想知道,是否可以使用
Entity Framework 6
(而非Entity Framework Core
)开发ASP.NET Core MVC
应用程序?
Based on the documentation of ASP.NET Core , it says: 根据ASP.NET Core的文档 ,它说:
To use Entity Framework 6, your project has to compile against the full .NET Framework, as Entity Framework 6 does not support .NET Core.
要使用Entity Framework 6,您的项目必须针对完整的.NET Framework进行编译,因为Entity Framework 6不支持.NET Core。 If you need cross-platform features you will need to upgrade to Entity Framework Core.
如果您需要跨平台功能,则需要升级到Entity Framework Core。
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. 如果您只需要Net Core的速度,可以将Db Context类放在另一个.Net Framework项目中,然后从Net Core项目添加对该项目的引用。
By doing that, you can use EF 6 in Net core and also gain the speed of Net Core web project. 通过这样做,您可以在Net core中使用EF 6,并获得Net Core Web项目的速度。
The drawback is you loss cross-platform features. 缺点是您丢失了跨平台功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.