I basically want this query:

select distinct name from mytable order by name;

The following works, but I find it rather overly complex:

var formSyn = session.QueryOver<Models.NlpFormSynonyms>()
   .OrderBy(p => p.Name).Asc
   .Select(s => s.Name)

 
.RootCriteria.SetProjection(Projections.Distinct(Projections.Property<Models.NlpFormSynonyms>(p
=> p.Name)))
   .List<Models.NlpFormSynonyms>();


I've also tried this:

var formSyn = session.QueryOver<Models.NlpFormSynonyms>()
   .OrderBy(p => p.Name).Asc
   .Select(s => s.Name)
   .TransformUsing(Transformers.DistinctRootEntity)
   .List();

Which looks nicer, but causes the runtime exception:

An unhandled exception of type 'NHibernate.Exceptions.GenericADOException'
occurred in NHibernate.dll

Additional information: Unable to perform find[SQL: SQL not available]

What's the best way to do this?  Thanks!

Mike

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to