【问题标题】:LINQ left join using Castle Active Records?LINQ 使用 Castle Active Records 离开连接?
【发布时间】: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


    【解决方案1】:

    目前看来这是不可能的。

    如果我或其他人找到可行的解决方案,我将更新此答案。

    【讨论】:

      【解决方案2】:

      【讨论】:

      • 这会在NHibernate.Linq.Visitors.QueryModelVisitor.VisitGroupJoinClause(GroupJoinClause groupJoinClause, QueryModel queryModel, Int32 index) 处引发The method or operation is not implemented-Exception...
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多