How do I select a Random Row using NHibernate's ICriteria API?

前端 未结 2 622
醉话见心
醉话见心 2020-12-05 22:01

Can I select a random row using NHibernate\'s ICriteria API?

2条回答
  •  庸人自扰
    2020-12-05 22:32

    If you are not limited to using ICriteria, I might recommend using HQL instead for selecting a random row, since it may provide more flexibility to use the Random function supplied by your db provider.

    
    IQuery q = NHibernateSession.CreateQuery("your hql statement here")
    
    

提交回复
热议问题