简体   繁体   English

在 dot net core 项目中使用 dot net Entity Framework 类库构建

[英]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 的版本,因此很难为您提供准确的建议。

.NET Core EF6 compatibillity .NET Core EF6 兼容性

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 有益/需要提供建议。

Conclusion结论

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.

相关问题 播种点网核心实体框架数据库的更好方法? - Better way to Seed a Dot Net Core Entity Framework Database? 如何将ConnectionString从appsettings.json文件传递到dot net core 2.2中的类库项目 - How to pass ConnectionString from appsettings.json file to class library project in dot net core 2.2 如何在通用Windows类库中使用最新的dot net core? - How to use latest dot net core in Universal Windows Class Library? 在.NET Framework类库项目中安装Entity Framework Core 2.0会产生无效的引用 - Installing Entity Framework Core 2.0 in a .NET Framework Class Library Project Yields Invalid References C#点网络核心从网络框架dll扩展类 - C# dot net core extend class from net framework dll 使用Dot Net核心实现缓存管理器 - Implementing Cache manager using Dot Net core 使用 ASP.NET Core 2.2 Web API 项目中的实体框架类库时抛出异常 - Exception thrown when using Entity Framework class library from ASP.NET Core 2.2 Web API project 在 .NET 核心项目中使用 .NET 框架 class 库 - Consume .NET Framework class library in .NET Core project 实体框架DB第一种方法用于.NET核心类库项目“Microsoft.EntityFrameworkCore.Tools” - Entity Framework DB first approach for .NET Core Class Library Project “Microsoft.EntityFrameworkCore.Tools” Dot Net core - 为实体问题生成代码 - Dot Net core- Generate code for entity issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM