EF core 6 then Include issue
Mohan Chanchal
0
Reputation points
In EF core 3.1 I am able to include a collection of object using include statement. After that then include is not working in EF core 6
eg
public class Parent
{
public int Id { get; set; }
public string Name { get; set; }
public List<Child> Children { get; set; }
}
public class Child
{
public int Id { get; set; }
public string Name { get; set; }
public int ParentId { get; set; }
public Parent Parent { get; set; }
public List<GrandChild> GrandChildren { get; set; }
}
public class GrandChild
{
public int Id { get; set; }
public string Name { get; set; }
public int ChildId { get; set; }
public Child Child { get; set; }
}
var result = dbContext.Parents
.Include(p => p.Children) // Include the list of Children
.ThenInclude(c => c.GrandChildren) // Include the list of GrandChildren inside Children
.ToList();
This query not working anymore please update why this feature is removed?
Developer technologies ASP.NET ASP.NET Core
4,815 questions
Developer technologies .NET Other
4,103 questions
Sign in to answer