我想知道是否有比以下简单示例更简单的查询ef core的方法。我想避免两次调用Test3以便包含Test3的所有所需属性:
public class Test1
{
}
public class Test2
{
}
public class Test3
{
public Test1 Test1 { get; set; }
public Test2 Test2 { get; set; }
}
public class Test4
{
public Test3 Test3 { get; set; }
}
public class Test5
{
public Test5(DataContext context)
{
var t = context.Test4
.Include(o => o.Test3)
.ThenInclude(o => o.Test1)
.Include(o => o.Test3)
.ThenInclude(o => o.Test2);
}
}