private void DiscardTransaction() { if (ScopedTransaction != null) { ScopedTransaction.Discard(); } }
/// <summary> /// Commits the transaction scoped by this object. This is equivalent to <c>ScopedTransaction.Commit()</c>. /// </summary> /// <exception cref="Persistence.PersistenceException">Changes to objects from multiple storage providers were made.</exception> /// <exception cref="Persistence.StorageProviderException">An error occurred while committing the changes to the data source.</exception> public void Commit() { if (ScopedTransaction != null) { ScopedTransaction.Commit(); } }
/// <summary> /// Performs a rollback on the transaction scoped by this object. This is equivalent to <c>ScopedTransaction.Rollback()</c>. /// </summary> public void Rollback() { if (ScopedTransaction != null) { ScopedTransaction.Rollback(); } }
private void ExecuteAutoRollbackBehavior() { if (AutoRollbackBehavior == AutoRollbackBehavior.Rollback && ScopedTransaction.HasChanged()) { Rollback(); } else if (AutoRollbackBehavior == AutoRollbackBehavior.Discard) { DiscardTransaction(); } }
public static async Task <ITransaction> BeginTransactionAsync( this IEventStore eventStore, Tenant tenant, string streamName, Guid aggregateId) { var scopedTransaction = new ScopedTransaction( (await eventStore.GetStreamAsync(tenant, streamName)), aggregateId); await scopedTransaction.CreateAsync(); return(scopedTransaction); }