How to get this kind of query in NHibernate : SELECT DISTINCT FileName From CustomerFile WHERE name = ' ' AND timeframe = ''
Please do not redirect me towards the other similar kinds of HQL in Stackoverflow, because they did not work for me. I really appreciate your direction on it. Thanks.
Reproducing this kind of query in Nhibernate with ICriteria API :
SELECT DISTINCT FileName From CustomerFile WHERE name = ' ' AND timeframe = '' 开发者_JS百科
Why not just use the custom SQL that you've sketched in, above, and map the result column to Strings? Why jump through ORM hoops to do something simple?
session
.CreateSQLQuery("SELECT DISTINCT FileName From CustomerFile WHERE name = ' ' AND timeframe = ''")
.AddScalar("FILENAME", NHibernateUtil.String)
精彩评论