希望在通用Windows应用程序中使用Entity Framework 7(实体框架核心)和SQLite .
找不到.Include(x => x.SomeNvaigationProperty)
.Include()没有出现在intellisense中
System.Data.Entity中的.Include()
System.Data.Entity在UWP中不可用
在UWP中使用什么(如.Include())?
public class Parent
{
public Guid Id { get; set; }
public List<Child> Childs { get; set; }
}
public class Child
{
public Guid Id { get; set; }
public Guid ParentId { get; set; }
public Parent Parent { get; set; }
}
dbContext.Parent.Include(x => x.Childs).ToList();
dbContext.Childs.Include(x => x.Parent).ToList();
2 回答
在实体框架7中.Include()放置 Microsoft.EntityFrameworkCore
您为
.Include()
添加了错误的命名空间using System.Linq
. 你需要添加using System.Data.Entity
然后你会得到.Include()