Ejemplo n.º 1
0
        public void ActualizarSQL(string sqlUpdate)
        {
            ITransaction tx = null;

            try
            {
                session = NHibernateSessionSingleton.GetSession();
                tx      = session.BeginTransaction();
                int updatedEntities = session.CreateSQLQuery(sqlUpdate).ExecuteUpdate();
                session.Flush();
                tx.Commit();
            }
            catch
            {
                if (tx != null)
                {
                    tx.Rollback();
                }
                throw;
            }
            finally
            {
                NHibernateSessionSingleton.CloseSession();
            }
        }
Ejemplo n.º 2
0
        public void Actualizar(T value)
        {
            ITransaction tx = null;

            try
            {
                session = NHibernateSessionSingleton.GetSession();
                tx      = session.BeginTransaction();
                session.SaveOrUpdate(value);
                session.Flush();
                tx.Commit();
            }
            catch
            {
                if (tx != null)
                {
                    tx.Rollback();
                }
                throw;
            }
            finally
            {
                NHibernateSessionSingleton.CloseSession();
            }
        }
Ejemplo n.º 3
0
        public void Sincronizar()
        {
            ITransaction tx = null;

            try
            {
                session = NHibernateSessionSingleton.GetSession();
                session.Flush();
            }
            catch
            {
                throw;
            }
            finally
            {
                NHibernateSessionSingleton.CloseSession();
            }
        }