Can I use table-valued function as query source in NHibernate?

我们两清 提交于 2019-12-05 16:35:32

All NHibernate query methods except SQL (HQL, Criteria, Linq, QueryOver) work on entities, not tables or any other DB artifacts.

Therefore, if you are using Criteria, you need to either map FnMyTableValuedFunction to an entity, or use SQLCriterion for an arbitrary SQL block.

With the latter, yes, EXISTS is probably the way to go. You can just enclose the whole condition (including the EXISTS) in a SQLCriterion.

You might be able to add a custom method into a derived SQLDialect, and use that in a criteria, look into RegisterFunction in NHibernate.Dialect.Dialect which all Dialects inherits.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!