I use asp.net, c# and EF4.
I’m puzzled by this LINQ query:
var queryContents = from a in context.CmsContentsAssignedToes
where a.UserId == myUserGuid
join cnt in context.CmsContents
on a.ContentId equals cnt.ContentId
where cnt.TypeContent == myTypeContent & cnt.ModeContent == myModeContent
select cnt;
I would like write its equivalent in LINQ method syntax to retrieve CmsContents.
In my conceptual model are two entity types:
- CmsContent
- CmsContentsAssignedTo
and their entity sets:
- CmsContents
- CmsContentsAssignedToes
and navigation properties:
- in CmsContent –> CmsContentsAssignedTo RETURN: –> Instance of CmsContentsAssignedTo
- in CmsContentsAssignedTo –> CmsContent RETURN: –> Instance of CmsContent
Do you know how to do it? I tried for more that one day but I cannot solve it!
Thanks for your time!
The equivalent method syntax is:
See my Edulinq blog post on query expressions for more details of how this works, and particularly where the “z” comes from (it’s not really called “z”; it doesn’t have a name as it’s a transparent identifier).