How to get a distinct result with nHibernate and QueryOver API?

If you’re using the ICriteria API, you need:

.SetResultTransformer(new DistinctEntityRootTransformer())

If you’re using the QueryOver API, you need:

.TransformUsing(Transformers.DistinctRootEntity)

But beware, this all occurs on client side, so all the duplicate rows are still pulled from SQL database.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)