首页 文章

EF7 UWP SQLite .Include()方法

提问于
浏览
1

希望在通用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();

enter image description here

2 回答

  • 0

    在实体框架7中.Include()放置 Microsoft.EntityFrameworkCore

  • 2

    您为 .Include() 添加了错误的命名空间 using System.Linq . 你需要添加 using System.Data.Entity 然后你会得到 .Include()

相关问题