Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用linq查询和groupBy时不支持异常_C#_Nhibernate_Linq To Nhibernate - Fatal编程技术网

C# 使用linq查询和groupBy时不支持异常

C# 使用linq查询和groupBy时不支持异常,c#,nhibernate,linq-to-nhibernate,C#,Nhibernate,Linq To Nhibernate,运行此Linq查询时,我得到一个“NotSupportedException”。“不支持指定的方法。”什么方法?即使注释掉了“Count()”,错误也是一样的。空内部异常 堆栈跟踪: 在Hydra.WPF.ViewModels.AddressListViewModel.\u primaryMemberListWorker\u DoWork(对象 发送方,DoWorkEventArgs e)在 M:\Projects\Hydra\WPF\ViewModels\AddressList\Address

运行此Linq查询时,我得到一个“NotSupportedException”。“不支持指定的方法。”什么方法?即使注释掉了“Count()”,错误也是一样的。空内部异常

堆栈跟踪:

在Hydra.WPF.ViewModels.AddressListViewModel.\u primaryMemberListWorker\u DoWork(对象 发送方,DoWorkEventArgs e)在 M:\Projects\Hydra\WPF\ViewModels\AddressList\AddressListViewModel.cs:line 1377 at System.ComponentModel.BackgroundWorker.WorkerThreadStart(对象 (论据)

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);
var分组=
(来自会话中的mem.Query()
mem.Id上的join detail in session.Query()等于detail.Member.Id
将d2加入(会话中的d3.Query()中)
其中d3.AddressList.Id==criteria.AddressList.Id
将d3按d3.Address+d3.Address2分组为x
其中x.Count()>1
在细节上选择x)。地址+细节。地址2等于d2。键
其中detail.AddressList.Id==criteria.AddressList.Id
选择mem);

如何生成标准变量?如果这本身就是一个延迟的查询或其他什么,那么听起来很可能是罪魁祸首。如果执行
var criteriaId=criteria.AddressList.Id在查询之前,并向查询提供criteriaId而不是criteria.AddressList.Id?

Hibernate的linq实现在基本运算符上存在问题。我想知道我们什么时候才能最终得到一个像样的实现…1377只是对存储此方法的存储库方法的调用。您可以按照以下方式编写相同的代码。您是否得到了最终解决方案?