Microsoft.Isam.Esent.Interop.Transaction.Rollback C# (CSharp) Method

Rollback() public method

Rollback a transaction. This object should be in a transaction.
public Rollback ( ) : void
return void
        public void Rollback()
        {
            this.CheckObjectIsNotDisposed();
            if (!this.IsInTransaction)
            {
                throw new InvalidOperationException("Not in a transaction");
            }

            Api.JetRollback(this.sesid, RollbackTransactionGrbit.None);
            this.ResourceWasReleased();
            Debug.Assert(!this.IsInTransaction, "Commit finished, but object is still in a transaction");
        }

Usage Example

 public void CreateRollbackAndBegin()
 {
     using (var transaction = new Transaction(this.sesid))
     {
         Assert.IsTrue(transaction.IsInTransaction);
         transaction.Rollback();
         Assert.IsFalse(transaction.IsInTransaction);
         transaction.Begin();
         Assert.IsTrue(transaction.IsInTransaction);
     }
 }
All Usage Examples Of Microsoft.Isam.Esent.Interop.Transaction::Rollback