Oh sorry, on that first example I meant:

.List<String>();

instead of:

.List<Models.NlpFormSynonyms>();


On Fri, Jan 24, 2014 at 12:31 PM, Mike Christensen <[email protected]>wrote:

> 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