So, according to this page , the Entity Framework should look forward to loading multiple layers using Selectin method Include.
I have the following code:
var reports = _context.Reports
.Include(rt => rt.Fields)
.Include(rt => rt.Fields.Select(f => f.FieldType))
.Include(rt => rt.Fields.Select(f => f.FieldType.FieldIdentifier));
However, this causes InvalidOperationException“Invalid expression type” when invoking the second include. The exception comes from EntityFrameworkHelper.CollectRelationalMemebers.
I also tried using strings for Includerelated properties, but that also failed (I would prefer to avoid using strings, if at all possible).
I am using the EF 5.0 DLL for .NET 4.0. My EF classes are old fashioned databases - first EntityObjects.
Does anyone know the reason and can I do anything with this exception?
EDIT:
When using the string version:
var reports = _context.Reports
.Include("Fields")
.Include("Fields.FieldType")
.Include("Fields.FieldType.FieldIdentifier"));
InvalidOperationException - .