I'm trying to use dynamic linq to query data. Now I have a (normal) linq query like:
from u in c.Users
from d in u.Documents
select d.DocumentID
I'm looking for the equivalent of this in dynamic linq. The emphasis is on how to navigate from the User entity to the Document entity. I can do something like:
c.Users.Select("new (UserName)");
But of course i cannot do:
c.Users.Select("new (Documents.DocumentID AS DocumentID)");
I thought i might be able to do something like:
var q = c.Users.Select("Documents");
q.Select("new (DocumentID)");
But this doesn't work.
I've found tons of examples of using navigation properties in where clauses. I've been able to use them in where clauses, but not in the select.
I've found one example of someone doing:
c.Users.SelectMany("Documents").Select("new (DocumentID)");
However, dynamic linq doesn't seem to have support for selectMany. At least there doesn't seem to be any overload to selectmany accepting a string as input when dynamic linq is included.
Is there anyone who can push me into the right direction? I would also welcome suggestions on how to do the selectmany without dynamic linq as well, as long as the "Documents" part and the select list (in this case "DocumentID" is dynamic and can be determined by a string input