"the method join is not supported" with Tridion OData service & Linq
linq, tridion, tridion-2011, tridion-content-delivery
Solution
To my knowledge, LINQ queries against Data Services (OData) does not support several methods. The one you are using is `join` is also falls under the same category hence you are seeing the error even though the syntax is very valid from LINQ point of view. `join` falls under "Projection and filtering operators" which is not supported query with LINQ against OData .
Here is the link that explains all the unsupported methods (Refer section - Unsupported LINQ Methods)
http://msdn.microsoft.com/en-us/library/ee622463(v=vs.100).aspx
Back to your question, I am not quite how to achieve what you are looking for but I would try the following (you might have to get the results in multiple iterations):
- Get the list of Page IDs that match the custom meta query (sample snippet - not tested)
_client.CustomMetas.Where (
m => m.KeyName == "somekey" && m.StringValue == "somevalue" && m.ItemType == 64)
.ToList();
- Now you could query Page Contents using the above page ids. You might have build the filter type query for each page id.
Hope this helps.
Problem
I'm trying to a join CustomMeta & PageContents to select a specific page via some metadata that has been set, but I'm getting a "the method join is not supported" error. I think the issue is with my linq statement, as the error happens before anything gets sent to the OData service. But what is the issue exactly? The linq statement looks fine to me: ``` var pages2 = (from p in cds.PageContents join m in cds.CustomMetas on p.PageId equals m.ItemId where m.ItemType==64 && m.KeyName=="SomeKey" && m.StringValue=="SomeValue" select p).ToList<SDLODataClient.SDLOData.PageContent>(); ``` UPDATE 1 This Tridion OData article has an example of a join but some of the MS Linq to OData articles I'm reading seem to suggest that joins aren't supported in Linq to OData (here)