session.QueryOver<SettingsEntity>().WhereRestrictionOn(s => s.Id).IsIn(inSettingsIDs).List<SettingsEntity>();
> --
> You received this message because you are subscribed to the Google Groups "nhusers" group.
> To post to this group, send email to nhu...@googlegroups.com.
> To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
>
It works like a charm.
PS. Linq-Lambda contains version (first one from my original question)
is more intuitive for those who migrate from EF
2011/10/16 Ted Parnefors <ted.pa...@gmail.com>:
There is also an extension method that allows you to write the query like
this:
return
session.QueryOver<SettingsEntity>()
.Where(s => s.ID.IsIn(intSettings))
.List();
You'll need to add a using NHibernate.Criterion statement. Also note, you
don't need the final cast on the List() call (if you're returning the same
type as the root entity).
It's also worth noting that QueryOver is not the NHibernate LINQ provider -
it's a strongly/statically typed syntax that wraps the ICriteria API. There
is also a LINQ provider which might give you the kind of syntax you're
looking for:
return
session.Query<SettingsEntity>()
.Where(s => intSettings.Contains(s.ID))
...
Hope that helps.
Richard