【发布时间】:2011-07-02 13:28:33
【问题描述】:
如何使用 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 };
【问题讨论】:
标签: c# linq join castle-activerecord