c# - 无法在 .NET 标准 2 项目中使用 Entity Framework

标签 c# entity-framework entity-framework-6 .net-standard-2.0

如何在 .NET Standard 项目中使用 Entity Framework 或类似的东西?

.NET Standard 2 似乎不支持 EF,这真的很烦人!

所以我尝试使用 Microsoft.EntityFrameworkCore.SqlServer 和 icrosoft.EntityFrameworkCore.SqlServer.Design

虽然我可以安装这些包,但我无法添加模型

我得到了错误

---------------------------
Microsoft Visual Studio
---------------------------
The project's target framework does not contain Entity Framework runtime assemblies. Please review the target framework information in the project's property page.
---------------------------
OK   
---------------------------

我该如何解决这个问题?

我正在认真考虑从我的所有项目中摆脱 .NET Standard,但这有点过激!

保罗

最佳答案

看起来真正的问题是“我如何像使用 EF 6 一样使用 EF Core 创建模型和逆向工程数据库”?

该工具独立于 NuGet 包。 Visual Studio 2017 不包括适用于 EF Core 的建模或逆向工程工具。这些可通过 EF Core Power Tools 获得一个开源插件。您可以找到代码和文档 here

关于c# - 无法在 .NET 标准 2 项目中使用 Entity Framework ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48582603/

相关文章:

c# - 尽管定义了返回对象,NSubstitute Async 仍返回 null

asp.net-mvc - 无法检索 'MyService.Entities.Email' 的元数据。 'System.Data.Entity.Internal.AppConfig' 的类型初始值设定项引发异常

c# - Entity Framework 运行转换代码时抛出异常

c# - EF 迁移和时间戳列,无法更新/运行

c# - 使用可能为空的列表通过 EF6 进行查询

c# - 为什么 context.SaveChanges() 更新表中的每一行?

entity-framework - EntityFramework 6.1 无法连接

c# - 在不缩放的情况下调整 Image<Gray, byte> 的大小。埃姆古简历

c# - 根据当前 IPrincipal 查找用户邮箱

c# - LinkedIn oAuth2 请求 token 400 错误请求