Assume having these models first:
Method
that has one OriginalCode
OriginalCode
that has many Mutant
s
Mutant
that has many ParseSubTree
s
Now when querying on Method
I want the other being loaded. So I have the following:
Method targetMethod = dBContext.Methods
.Include(me => me.OriginalCode)
.ThenInclude(oc => oc.Mutants)
.FirstOrDefault(me => me.Id == id);
and the next step is to include additionally the ParseSubTree
. But the thing is that I can't access it. See the following Image:
the problem is "mu is a list instead of being an object reference"!
Where is my mistake!
TG.
This is a known Intellisense issue with the
ThenInclude
overload for collection type navigation properties, tracked by the Completion missing members of lambda parameter in fault tolerance case #8237 Roslyn GitHub issue.Until it gets fixed, simply type the name of the property and it will compile successfully and work as expected.
Update: Now it's even specifically mentioned in the Including multiple levels section of the EF Core documentation: