public IList <T> GetAll <T>() where T : class { using (var session = NHibernateSessionHelper.OpenSession()) { if (null == session) { return(new List <T>()); } using (session.BeginTransaction()) { return(session.QueryOver <T>().List()); } } }
public void Add <T>(T obj) { using (var session = NHibernateSessionHelper.OpenSession()) { if (null == session) { return; } using (var transaction = session.BeginTransaction()) { session.Save(obj); transaction.Commit(); } } }