How can I use QueryOver's linq query separated like below ICriteria which will be used in a generic method?
ICriterion c = Restrictions.And(Restrictions.Eq("Name", "Foo"),
Restrictions.Or(Restrictions.Gt("Age", 21), Restrictions.Eq("HasCar",true)));
IQueryOver<Foo> c = session.QueryOver<Foo>().Where((k => k.Name == "Tiddles"
&& k => k.Age== 21) || k => k.Age < 21);
public static IList<T> All(ICriterion c)
{
using (var session = NHibernateHelper<T>.OpenSession())
{
var CC = session.CreateCriteria(typeof(T));
CC.Add(c);
return CC.List<T>();
}
}