Example #1
0
 public ITransaction BeginTransaction(IsolationLevel isolationLevel)
 {
     Guard.Against<InvalidOperationException>(_transaction != null,
                                              "Cannot begin a new transaction while an existing transaction is still running. " +
                                              "Please commit or rollback the existing transaction before starting a new one.");
     _transaction = new Db4oTransaction(ObjectContainer);
     _transaction.TransactionCommitted += TransactionCommitted;
     _transaction.TransactionRolledback += TransactionRolledback;
     return _transaction;
 }
Example #2
0
 public ITransaction BeginTransaction(IsolationLevel isolationLevel)
 {
     Guard.Against <InvalidOperationException>(_transaction != null,
                                               "Cannot begin a new transaction while an existing transaction is still running. " +
                                               "Please commit or rollback the existing transaction before starting a new one.");
     _transaction = new Db4oTransaction(ObjectContainer);
     _transaction.TransactionCommitted  += TransactionCommitted;
     _transaction.TransactionRolledback += TransactionRolledback;
     return(_transaction);
 }
Example #3
0
 /// <summary>
 /// Releases the current transaction in the <see cref="NHUnitOfWork"/> instance.
 /// </summary>
 private void ReleaseCurrentTransaction()
 {
     if (_transaction != null)
     {
         _transaction.TransactionCommitted  -= TransactionCommitted;
         _transaction.TransactionRolledback -= TransactionRolledback;
         _transaction.Dispose();
     }
     _transaction = null;
 }
Example #4
0
        /// <summary>
        /// Disposes off managed resources used by the NHUnitOfWork instance.
        /// </summary>
        /// <param name="disposing"></param>
        private void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }
            if (_disposed)
            {
                return;
            }

            if (_transaction != null)
            {
                _transaction.Dispose();
                _transaction = null;
            }

            if (ObjectContainer != null)
            {
                ObjectContainer.Dispose();
                ObjectContainer = null;
            }
            _disposed = true;
        }
Example #5
0
 /// <summary>
 /// Releases the current transaction in the <see cref="NHUnitOfWork"/> instance.
 /// </summary>
 private void ReleaseCurrentTransaction()
 {
     if (_transaction != null)
     {
         _transaction.TransactionCommitted -= TransactionCommitted;
         _transaction.TransactionRolledback -= TransactionRolledback;
         _transaction.Dispose();
     }
     _transaction = null;
 }
Example #6
0
        /// <summary>
        /// Disposes off managed resources used by the NHUnitOfWork instance.
        /// </summary>
        /// <param name="disposing"></param>
        private void Dispose(bool disposing)
        {
            if (!disposing)
                return;
            if (_disposed)
                return;

            if (_transaction != null)
            {
                _transaction.Dispose();
                _transaction = null;
            }

            if (ObjectContainer != null)
            {
                ObjectContainer.Dispose();
                ObjectContainer = null;
            }
            _disposed = true;
        }