nHibernate 标准 - 我如何实现“具有计数”?
我有以下表结构,我想将查询转换为 NH 标准,但我不确定如何合并正确的“投影”,有人知道如何吗?
我想将查询转换为条件:
select ComponentId from Table_1
where [Name] = 'Contact' or [Name] = 'CurrencyPair'
group by ComponentId
having count(VersionId) = 2
I have the following table structure and I want a turn the query into a NH criteria but I'm not sure how to incorporate the correct 'Projection', does anyone know how?
And the query I want to turn into a Criteria:
select ComponentId from Table_1
where [Name] = 'Contact' or [Name] = 'CurrencyPair'
group by ComponentId
having count(VersionId) = 2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我试图找到解决我的问题的方法时,我遇到了这个问题。
就我而言,我试图返回包含用户指定的所有子记录的所有记录。
我最终使用了一个子查询,该子查询将子记录过滤为用户指定的子记录并返回计数,并检查子查询的计数是否等于用户指定的子记录数。
与您的情况略有不同,但希望有所帮助。
I came across this question when trying to find a solution to my problem.
This post was useful.
In my case I was trying to return all records which have all the sub records the user specifies.
I ended up using a sub query which filters the sub records to the ones the user specified and returns the count, and checking that the count of the sub query equals the number of sub records the user specified.
Bit different from your scenario, but hope helps.