Recently I wrote this query with Linq (Method Syntax), notes:
g.CmsContents is a Navigatiola Property.
I would like to know how to rewrite this code as a Linq Query Expression if it is possible.
var myGroupsTypesList = from g in context.CmsGroupsTypes
where g.CmsContents.Any(x => x.ContentId == myContentId)
select g;
Any idea? Thanks for your support 🙂
That’s already a query expression. If you mean you want to convert the
Anypart to another query expression – you can’t. There’s no query expression support forAny.If you actually meant it the other way round, your query is equivalent to: