Esempio n. 1
0
        public static IList <T> RetrieveAll()
        {
            IList <T> theList = new List <T>();

            using (var session = new CoreDAO <T>().GetSession())
            {
                using (var trans = session.BeginTransaction())
                {
                    theList = session.Query <T>().ToList();
                    trans.Commit();
                }
            }

            return(theList);
        }
Esempio n. 2
0
 public static void Save(T obj)
 {
     try
     {
         using (ISession session = new CoreDAO <T>().GetSession())
         {
             using (ITransaction transaction = session.BeginTransaction())
             {
                 session.Save(obj);
                 transaction.Commit();
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }