I think you can achieve this with DetachedCriteria. The syntax and usage would be like this:
var det = DetachedCriteria.For<T>.Add(Restrictions.Eq(prop, val));
using (var session = Config.OpenSession())
using (var txn = session.BeginTransaction())
{
var result= det.GetExecutableCriteria(session).List();
}
You could easily encapsulate the transaction in a separate function:
public IList<T> GetList<T>(DetachedCriteria detachedCriteria)
{
IList<T> result;
using (var session = Config.OpenSession())
using (var txn = session.BeginTransaction())
{
result = detachedCriteria.GetExecutableCriteria(session).List<T>();
txn.Commit();
}
return result;
}