首页 > 解决方案 > Entity Framework Core 2.2.4 中 System.Data.Entity 的等价物是什么?

问题描述

我尝试IObjectSet在 .NET Core 2.2 的项目中使用该接口,但是使用 Entity Framework Core 2.2.4 的版本,它不起作用。

这是在 .NET Core 2.2.0 中

IObjectSet<TEntity> GetGroup<TEntity>() where TEntity : class, IObjectWithChangeTracker;

找不到类型或命名空间“IObjectSet<>”的名称。

标签: c#.net-core-2.2

解决方案


您需要更新 EF7。在 EntityFramework System.Data中是版本 6,在这种情况下,您可以使用 System.Data并且在 EF7 中您应该使用 EntityFramework.* nuget 包,如下所示

 using Microsoft.EntityFrameworkCore.*;

使用前阅读文档 https://github.com/aspnet/EntityFrameworkCore/tree/d1b10fc6ccca83e29109a0a8d9c047f2e68aede5


推荐阅读