Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public class Category
  2. {
  3. public int Id { get; set; }
  4. public int ParentCategoryId { get; set; }
  5. public string ChildIDs { get; set; }
  6. }
  7.  
  8. from cg in db.Categories
  9. where cg.Id == id
  10. join urc in
  11. (from x in db.UrlRecords where x.EntityName == "Category" select x) on cg.Id equals urc.EntityId into urccg
  12. from f in urccg.DefaultIfEmpty()
  13. select new
  14. {
  15. cg,
  16. f,
  17. ParentCategoryId = cg.ParentCategoryId,
  18. ChildIds = string.Join(",", (from x in db.Categories where x.ParentCategoryId == cg.Id select x.Id))
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement