[英]Using dot net Entity Framework class library build in dot net core project
I have a User Management Panel which is created on MVC dot net and Entity Framework Code first approach , entity framework being a separate class library build on dot net.我有一个用户管理面板,它是在 MVC dot net 和实体框架代码优先方法上创建的,实体框架是一个在 dot net 上构建的单独类库。
Now, I need to create an admin panel for it, and looking to create it on dot net core , However I plan to use the same database and EF Framework class library build on dot net standard.现在,我需要为它创建一个管理面板,并希望在dot net core上创建它,但是我计划使用相同的数据库和基于 dot net 标准的 EF Framework 类库。
Can This be achieved , that I keep a separate Project of Entity Framework .NET and it could be consumed by both .Net project as well as dot net core.这可以实现吗,我保留一个单独的实体框架 .NET 项目,它可以被 .Net 项目和 dot net core 使用。
As you did not provide the versions of MVC, Entity Framework and .NET Core you (intend to) use it is difficult to give you precise advice.由于您没有提供您(打算)使用的 MVC、Entity Framework 和 .NET Core 的版本,因此很难为您提供准确的建议。
As is adviced in this article it is adviced to work with Entity Framework Core when working with .NET Core.正如本文所建议的,在使用 .NET Core 时,建议使用 Entity Framework Core。 However Entity Framework 6 also supports .NET Core applications.但是 Entity Framework 6 也支持 .NET Core 应用程序。 This information can be found in an overview from the Microsoft Entity Framework Documentation site where they compare EF6 with EF Core此信息可以在 Microsoft 实体框架文档站点的概述中找到,他们将 EF6 与 EF Core 进行比较
EF Core 3.1 runs on .NET Core and .NET Framework, through the use of .NET Standard 2.0. EF Core 3.1 通过使用 .NET Standard 2.0 在 .NET Core 和 .NET Framework 上运行。 However, EF Core 5.0 will not run on .NET Framework.但是,EF Core 5.0 不会在 .NET Framework 上运行。 ... EF6.4 runs on .NET Core and .NET Framework, through multi-targeting. ... EF6.4 通过多目标运行在 .NET Core 和 .NET Framework 上。
In the same article they also compare the feature compatibility between EF6 and EF Core.在同一篇文章中,他们还比较了 EF6 和 EF Core 之间的功能兼容性。 They also give advice for when upgrading your DAL to EF Core is beneficial/ required when working with existing projects.他们还就在处理现有项目时何时将 DAL 升级到 EF Core 有益/需要提供建议。
You probably can use your existing Data Acces Layer written in EF6 with a .NET Core application however whether you should depends on the further development/ requirements of your application which you can find in this article .您可能可以将用 EF6 编写的现有数据访问层与 .NET Core 应用程序一起使用,但是是否应该取决于您的应用程序的进一步开发/要求,您可以在本文中找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.