Here is a quick general purpose nhibernate criteria call to retrieve a list of results where the id is in a list. It is written as a generic method that I placed in my base repository and can use it for all of my domain objects. So T resolves to the type of domain object you are retrieving.
public IEnumerable<T> Get(IEnumerable<IdType> ids)
{
var criteria = Session.CreateCriteria<T>()
.Add(Restrictions.In("Id", ids.ToArray()));
return criteria.List<T>();
}
The sql this generates is essentially:
select * from DomainObjectTable
where id in('id1', 'id2', ...)

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 