コード例 #1
0
        /// <summary>Applies the <see cref="LogMessage" /> and raises the <see cref="Committing" /> event</summary>
        protected virtual void OnCommitting(SvnCommittingEventArgs e)
        {
            if (LogMessage != null && e.LogMessage == null)
            {
                e.LogMessage = LogMessage;
            }

            Committing?.Invoke(this, e);
        }
コード例 #2
0
        /// <summary>
        ///     Asynchronously commits all changes made in this unit of work context to the database.
        /// </summary>
        /// <param name="cancellationToken">
        ///     The token that propagates a cancellation request to interrupt the operation.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous commit operation.
        ///     The task result contains the number of affected entries in the database.
        /// </returns>
        /// <exception cref="DbUpdateException">Thrown when an error is encountered while saving to the database.</exception>
        /// <exception cref="DbUpdateConcurrencyException">Thrown when a concurrency violation is encountered while saving to the database.</exception>
        public virtual async Task <int> CommitAsync(CancellationToken cancellationToken = default)
        {
            Committing?.Invoke(this, new UnitOfWorkCommittingEventArgs(_registeredRepositories));

            var affectedEntries = await Context.SaveChangesAsync(cancellationToken).ConfigureAwait(false);

            Committed?.Invoke(this, new UnitOfWorkCommittedEventArgs(affectedEntries, _registeredRepositories));

            return(affectedEntries);
        }
コード例 #3
0
        /// <summary>
        ///     Commits all changes made in this unit of work context to the database.
        /// </summary>
        /// <returns>The number of affected entries in the database.</returns>
        /// <exception cref="DbUpdateException">Thrown when an error is encountered while saving to the database.</exception>
        /// <exception cref="DbUpdateConcurrencyException">Thrown when a concurrency violation is encountered while saving to the database.</exception>
        public virtual int Commit()
        {
            Committing?.Invoke(this, new UnitOfWorkCommittingEventArgs(_registeredRepositories));

            var affectedEntries = Context.SaveChanges();

            Committed?.Invoke(this, new UnitOfWorkCommittedEventArgs(affectedEntries, _registeredRepositories));

            return(affectedEntries);
        }
コード例 #4
0
        /// <summary>
        /// Commits the current transaction.
        /// </summary>
        public void Commit()
        {
            if (!_isInTransaction)
            {
                throw new InvalidOperationException("The transaction was either already committed or rolled back.");
            }

            _rollbackOnDispose = false;
            _isInTransaction   = false;

            Committing?.Invoke(this, EventArgs.Empty);

            _parentTransaction.Release(_savePoint);

            Committed?.Invoke(this, EventArgs.Empty);
            Finished?.Invoke(this, EventArgs.Empty);
        }
コード例 #5
0
        /// <summary>
        /// Commits the current transaction.
        /// </summary>
        public void Commit()
        {
            if (_isDisposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            if (!_isInTransaction)
            {
                throw new InvalidOperationException("The transaction was either already committed or rolled back.");
            }

            Committing?.Invoke(this, EventArgs.Empty);
            _connection.Commit();
            Committed?.Invoke(this, EventArgs.Empty);

            FinishTransaction();
        }
 private void OnCommitting(CommittingEventArgs e)
 {
     Committing?.Invoke(this, e);
 }
コード例 #7
0
 /// <summary>Raises the <see cref="Committing" /> event.</summary>
 protected virtual void OnCommitting(SvnCommittingEventArgs e)
 {
     Committing?.Invoke(this, e);
 }