问题描述
public async任务< p>我正在尝试使用EF 7查询收集和子集合。列表<表>> GetAllTable(){
var tableList = await db.Tables.Include(o => o.Checks.Select(i => i.CheckItems))ToListAsync();
return tableList;
}
我按照这里的语法 您正在阅读的文档是EF 5。 设计会议笔记对于EF 7说,这个语法已经改变了 - 尝试这样: I am trying to query a collection and child collection using EF 7. Here's the code: I'm following the syntax from here MSDN. However, when i run this code i'm getting the following error. Does anyone know what went wrong here? Thanks! The documentation you are reading is for EF 5. The design meeting notes for EF 7 say the syntax of this has changed - try this: 这篇关于包括一个集合,然后一个集合一级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
db.Tables.Include(t => t .Checks)
.ThenInclude(c => c.CheckItems)
.ToListAsync()
public async Task < List < Table >> GetAllTable() {
var tableList = await db.Tables.Include(o => o.Checks.Select(i => i.CheckItems)).ToListAsync();
return tableList;
}
db.Tables.Include(t => t.Checks)
.ThenInclude(c => c.CheckItems)
.ToListAsync()