如何使用LINQ和Castle Active Records执行左连接?
如果尝试以下内容:
from account in AccountRecord.Queryable
join s in SchoolRecord.Queryable on account equals s.Account into schools
where account.PaymentType == "S"
select new { Account = account, School = schools.ElementAt(0) };
但是这引起了以下异常:
无法投射类型的对象 'Remotion.Data.Linq.Clauses.GroupJoinClause' 输入 'Remotion.Data.Linq.Clauses.FromClauseBase'。
执行以下工作(但不是我想要的,因为我需要左连接):
from account in AccountRecord.Queryable
where account.PaymentType == "S"
from school in SchoolRecord.Queryable
where school.Account == account
select new { Account = account, School = school };
答案 0 :(得分:2)
目前看来这是不可能的。
如果我或其他人找到可行的解决方案,我会更新此答案。
答案 1 :(得分:-1)