I have a schema like so. Menu->Pages->PageRoles->ASPNetRoles
Menu has a CategoryID.
I want to return all Menu items with a CategoryID of 6.
Some Menu ite
If the SQL queries generated to fill your anonymous types doesn't match, no way: you must do something like this:
dd.ToList().AddRange(ss.ToList());
And of course, this implies double request to your database.
It looks like you're bumping into a bug in SubSonic's implementation of Union/Concat, you should report it to the google code site. You should just be able to do the following, which I'm pretty sure you'd already worked out:
var unionList = dd.Concat(ss).ToList<Menu>();
In the meantime the following should be pretty close to the outer join you're after:
var ss = from menu in Menu.All()
group join pages in WebPage.All() on menu2.PageID equals pages.ID
into pagesMenu from pm in pagesMenu.DefaultIfEmpty()
group join pagesRoles in PageRole.All() on pages.ID equals pagesRoles.PageID
into pagesRolesPages from prp in pagesRolesPages.DefaultIfEmpty()
group join roles in aspnet_Role.All() on pagesRoles.RoleId equals roles.RoleId
into pagesRolesRoles from prr in pagesRolesRoles.DefaultIfEmpty()
where menu.PageID == null ||
(Roles.GetRolesForUser().Contains(roles.RoleName) && menu2.CategoryID == 6)
select menu;
Yeh, I'm the one that reports the LEFT OUTER JOIN problem. rob told me that the problem is by the Linq parser (Iqueryable provider impl). i think this is major issue because if u can't do more than just basic querys - you can't work with it at all...
so push rob to fix it ASAP. :-).
zahi.