public IList <T> FindByExample(T exampleInstance, params string[] propertiesToExclude) { ICriteria criteria = HibernateSession.CreateCriteria(_persistentType); Example example = Example.Create(exampleInstance); foreach (string propertyToExclude in propertiesToExclude) { example.ExcludeProperty(propertyToExclude); } criteria.Add(example); return(criteria.List <T>() as List <T>); }
/// <summary> /// Loads every instance of the requested type using the supplied <see cref="ICriterion" />. /// If no <see cref="ICriterion" /> is supplied, this behaves like <see cref="GetAll" />. /// </summary> protected IList <T> FindByCriteria(Order[] orders, params ICriterion[] criterion) { ICriteria criteria = HibernateSession.CreateCriteria(_persistentType); foreach (ICriterion criterium in criterion) { criteria.Add(criterium); } if (orders != null) { foreach (Order order in orders) { criteria.AddOrder(order); } } return(criteria.List <T>()); }