【发布时间】:2016-08-23 17:18:18
【问题描述】:
我正在尝试使用 Entity Framework Core 1.0 并尝试在通过 dbcontext 填充对象时使用 .Include。
EFTestContext context = new EFTestContext();
var testEntity = context.TestEntity
.Include(t => t.TestEntity2)
.ToList();
它给了我错误
不包含“包含”的定义,并且找不到接受“DbSet”类型的第一个参数的扩展方法“包含”
到目前为止,我在 Stackoverflow 中发现的唯一类似的东西是
IQueryable<T> does not contain a definition for 'Include' and no extension method 'Include'
但是添加 using 语句
using System.Data.Entity;
把错误告诉我
命名空间“System.Data”中不存在类型或命名空间名称“Entity”(您是否缺少程序集引用?)
有人知道我需要什么才能让包含显示在 WF Core 1.0 中吗?
【问题讨论】:
-
愚蠢的问题,但你的代码中有
using Microsoft.EntityFrameworkCore;。你提到了using System.Data.Entity;
标签: c#