Hello,
Have been happily using LLBLGen so far, what a wonderful piece of software. Congrats to whole the team!
The question:
I was wondering whether there would be an elegant way to create a grouping in a correlated query.
I want to fill up a class that consists of the following structure:
Person (the class)
|_______ PersonId (int)
|_______ Accounts (complex type) (a person can be member of multiple accounts)
|_______ AccountId (int)
|_______ Roles (complex type) (the person can be assigned multiple roles for a given account)
Tried but failed:
var q = from p in metaData.Person
join pwd in metaData.Password on p.PersonId equals pwd.PersonId
where pwd.Password == password
select new
{
PersonId = p.PersonId,
Accounts = from r in metaData.Role ('Role' is the link table/entity which contains all the information needed)
where p.PersonId == r.PersonId
group r by r.AccountId into g
select new
{
AccountId = g.Key,
RoleTypes = g.Select(r => r.RoleTypeId)
}
};
return q.FirstOrDefault();
The code above gives me following error:
Couldn't create any correlation filter lambda because the nested query didn't have any correlation filters. Please specify a filter in the nested query to tie the nested query to the parent query
I'm probably heavily abusing the group by functionality. When I remove the grouping the correlation works.
Is there a way to elegantly fill up my class?
Thanks in advance,
Tom
Runtime build: 12 02 2009
Runtime version: 2.6.0.0