Esempio n. 1
0
 public static void MakeTransient(Item entity)
 {
     using (ISession session = NHibernateHelper.OpenSession())
         session.Delete(entity);
 }
Esempio n. 2
0
 public virtual void MakeTransient(Item item)
 {
     AssertSessionIsBound();
     try
     {
         NHibernateHelper.GetCurrentSession().Delete(item);
     }
     catch(HibernateException ex)
     {
         throw new Exceptions.InfrastructureException(ex);
     }
 }
Esempio n. 3
0
 public static Item MakePersistent(Item entity)
 {
     using (ISession session = NHibernateHelper.OpenSession())
         session.SaveOrUpdate(entity);
     return entity;
 }
Esempio n. 4
0
 public virtual IList<Item> FindByExample(Item exampleItem)
 {
     AssertSessionIsBound();
     try
     {
         ICriteria crit = NHibernateHelper.GetCurrentSession()
             .CreateCriteria(typeof(Item));
         return crit.Add(Example.Create(exampleItem))
             .List<Item>();
     }
     catch(HibernateException ex)
     {
         throw new Exceptions.InfrastructureException(ex);
     }
 }