Click here to Skip to main content
15,908,020 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

C#
Expression<Func<SystemUser, object>>[] includeProperties = { x => x.Company.CompanyAddresses.Where(z=>z.AddressTypeId==5).Select(y => y.Address.Country.CountryRegions) };
                    var user = _SystemUserRepository.GetById(userID, includeProperties);



while I am executing the above query, it throws exception as "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties."

if I remove "where" clause from query, it executes fine.

could any one explain the reason?
Posted

1 solution

"if I remove "where" clause from query, it executes fine."
That's probably the clue. At a guess - and without your data that's all it can be - you need to look at how many values you have in the collection which match the criteria. I'm guessing that none do, so the GetById is being passed no values.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900