Created
February 17, 2011 11:43
-
-
Save TowardsDeath/831558 to your computer and use it in GitHub Desktop.
Tag-and-role query with Linq / LLBLGen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tags = from tag in data.Tag | |
join articleTag in data.ArticleTag on tag.Id equals articleTag.TagId | |
join articlesWithRole in | |
( | |
from articleTag in data.ArticleTag | |
join tagRole in data.TagForRole on articleTag.TagId equals tagRole.TagId | |
select new | |
{ | |
ArticleId = articleTag.ArticleId, | |
Role = tagRole.Role | |
} | |
) on articleTag.ArticleId equals articlesWithRole.ArticleId | |
where !( from tagRole in data.TagForRole | |
select tagRole.TagId ).Contains( tag.Id ) | |
&& tag.IsMainTag | |
select new | |
{ | |
Role = articlesWithRole.Role, | |
Tag = new TagEntity | |
{ | |
Id = tag.Id, | |
Title = tag.Title, | |
Description = tag.Description | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment