简体   繁体   English

EF7 UWP SQLite .Include()方法

[英]EF7 UWP SQLite .Include() method

Want use Entity Framework 7 (Entity Framework Core) with SQLite in Universal Windows Application. 想要在通用Windows应用程序中将Entity Framework 7(Entity Framework Core)与SQLite一起使用。

Can`t find .Include(x => x.SomeNvaigationProperty) 找不到.include(x => x.SomeNvaigationProperty)

.Include() doesn't appear in intellisense .include()不会出现在智能感知中

.Include() in System.Data.Entity System.Data.Entity中的.include()

System.Data.Entity not available in UWP System.Data.Entity在UWP中不可用

What use in UWP (as .Include())? 在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();

在此处输入图片说明

在Entity Framework 7中, Include()放置了Microsoft.EntityFrameworkCore

You are adding wrong namespace using System.Linq for .Include() . 您正在using System.Linq for .Include()添加错误的名称空间。 You need to add using System.Data.Entity then you will get .Include() 您需要using System.Data.Entity添加,然后您将获得.Include()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM