KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am attempting to build up a hierarchical collection using Entity Framework - see the below query - every member in a given company has a parent member - but when trying to execute this I get the following exception: System.NotSupportedException: The type 'Member' appears in two structurally incompatible initializations within a single LINQ to Entities query. A type can be initialized in two places in the same query, but only if the same properties are set in both places and those properties are set in the same order. If I remove the ParentMember assign it works - any ideas on what is going on? return from c in _Entities.Company where c.Deleted == false select new Member() { Name = c.Name, ParentMember = new Member() { Name = c.ParentMember.Name } };
Tags (comma-separated)
Save Edits
Cancel