entity-framework-core - 实体框架核心排除 INNER JOIN
问题描述
我对嵌套实体有疑问:
public class Person {
public int Id { get; set; }
public Department Department { get; set; }
}
public class Department {
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public IList<Person> People { get; set; } = new List<Person>();
}
public IAsyncEnumerable<Person>? ReadPersons()
{
return _dbContext.Persons?
.Include(p => p.Department)
.AsAsyncEnumerable();
}
public IAsyncEnumerable<Person>? ReadDepartments()
{
return _dbContext.Departments?
.Include(d => d.People)
.AsAsyncEnumerable();
}
当我阅读Person
Entity Framework Core 时,它People
包括Department
...
但是,如果我想People
在我阅读的情况下排除并在我的情况下ReadPerson
包括在内People
怎么ReadDepartment
办?
可能吗 ?
解决方案
推荐阅读
- python - 使用opencv和picamera(V2)在高分辨率下出现白/蓝平衡错误
- azure - Azure Functions 在 AppInsights 中缺少行
- c# - Nuget 上是否有 dotnet 核心的本地化资源?
- php - Cakephp 3.8.6 随机图片删除
- core-data - after delete of item in SwiftUI List (backed by Core Data) getting a "Thread 1: EXC_BAD_INSTRUCTION" error? (code attached)
- javascript - 将键/值对添加到特定的 Javascript 对象
- jpa - 如何手动设置 @GeneratedValue 的值
- vuejs2 - 基于组件创建方法的计算值
- python - 在python中重新定义列表的索引
- graphql - 如何使用 AppSync GraphQL 转换为一对多 @connection 执行 @auth?