EF7 UWP SQLite .Include()方法

时间:2016-06-07 11:17:49

标签: c# entity-framework sqlite uwp

希望在通用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 :(得分:2)

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

答案 1 :(得分:0)

您为[System.Windows.Forms.Screen]添加了错误的名称空间using System.Linq。 您需要添加.Include(),然后才能获得using System.Data.Entity

相关问题