Neo4jClient.Transactions.Neo4jTransaction.Rollback C# (CSharp) Метод

Rollback() публичный Метод

Rolls back our current transaction and closes the transaction.
public Rollback ( ) : void
Результат void
        public void Rollback()
        {
            CheckForOpenTransaction();
            // we have to check for an empty endpoint because we dont have one until our first request
            if (Endpoint == null)
            {
                CleanupAfterClosedTransaction();
                return;
            }

            //This change is due to: https://github.com/Readify/Neo4jClient/issues/127 and https://github.com/neo4j/neo4j/issues/5806 - 
            HttpStatusCode[] expectedStatusCodes = {HttpStatusCode.OK};
            if (_client.CypherCapabilities.AutoRollsBackOnError && _client.ExecutionConfiguration.HasErrors)
                    expectedStatusCodes = new [] {HttpStatusCode.OK, HttpStatusCode.NotFound};

            Request.With(_client.ExecutionConfiguration)
                .Delete(Endpoint)
                .WithExpectedStatusCodes(expectedStatusCodes)
                .Execute();

            CleanupAfterClosedTransaction();
        }

Usage Example

        public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
        {
            // we receive a commit message
            // if we own a local transaction, then commit that transaction
            if (_transaction != null)
            {
                _transaction.Rollback();
                _transaction = null;
            }
            else if (_transactionId > 0)
            {
                GetResourceManager().RollbackTransaction(_transactionId);
            }
            singlePhaseEnlistment.Aborted();

            _enlistedInTransactions.Remove(Transaction.Current);
        }
All Usage Examples Of Neo4jClient.Transactions.Neo4jTransaction::Rollback