运行此 Linq 查询时出现“NotSupportedException”。“不支持指定的方法。” 什么方法?即使注释掉了“Count()”,错误也是一样的。空内部异常。
堆栈跟踪:
在 Hydra.WPF.ViewModels.AddressListViewModel._primaryMemberListWorker_DoWork(Object sender, DoWorkEventArgs e) in M:\Projects\Hydra\WPF\ViewModels\AddressList\AddressListViewModel.cs: System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument) 的第 1377 行
SQL 查询:
Select * From _Members
Inner Join AddressDetailsCCN a on a.MemberId=_Members.MemberID
Inner Join
(
Select Address+Address2 as CombinedAddress
From AddressDetailsCCN Where ListId=84
group by Address+Address2
Having COUNT(*)>1
) B on B.CombinedAddress=A.Address+A.Address2
Where CombinedAddress is not null AND CombinedAddress!='' AND a.ListId=84
Order by ClientID, CombinedAddress
林克:
var grouped =
(from mem in session.Query<Member>()
join detail in session.Query<Detail>() on mem.Id equals detail.Member.Id
join d2 in (from d3 in session.Query<Detail>()
where d3.AddressList.Id == criteria.AddressList.Id
group d3 by d3.Address + d3.Address2 into x
where x.Count() > 1
select x) on detail.Address+detail.Address2 equals d2.Key
where detail.AddressList.Id==criteria.AddressList.Id
select mem);