Joining across ContentManager.Query and IRepository

Topics: Troubleshooting, Writing modules
Mar 12, 2012 at 2:41 PM
Edited Mar 12, 2012 at 2:43 PM

I want to create a join across several tables however one of the tables doesn't implement a contentpartrecord and rather implements IRepository. My question is can I join across a tables that implement contentpartrecord and Irepository?

This is the SQL I want to translate into a linq query that orchard can understand



SELECT DISTINCT route.Title, common.CreatedUtc
FROM Contrib_Taxonomies_TaxonomyPartRecord AS taxonomy 
	INNER JOIN Contrib_Taxonomies_TermPartRecord AS term 
		ON taxonomy.Id = term.TaxonomyId 
	INNER JOIN Contrib_Taxonomies_TermContentItem AS termContentItem 
		ON term.Id = termContentItem.TermRecord_id 
	INNER JOIN Routable_RoutePartRecord AS route 
		ON termContentItem.ContentItemRecord_id = route.ContentItemRecord_id 
	INNER JOIN Common_CommonPartRecord AS common 
		ON route.ContentItemRecord_id = common.Id
WHERE (taxonomy.TermTypeName = 'Categories')
ORDER BY common.CreatedUtc DESC


The problems I'm running into with the code portion is that Contrib_Taxonomies_TermContentItem implements IRepository so I can't join to it using the ContentManager.Query. Anyone have any insight into this problem I'm having?

Mar 13, 2012 at 12:19 AM

There is a new HQL feature on Content Manager. That's what the Projector module is using to build its queries.