Ejemplo n.º 1
0
        /// <summary>
        /// Increment the given version number
        /// </summary>
        /// <param name="version">The value of the current version.</param>
        /// <param name="versionType">The <see cref="IVersionType"/> of the versioned property.</param>
        /// <param name="session">The current <see cref="ISession" />.</param>
        /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
        /// <returns>Returns the next value for the version.</returns>
        public static async Task <object> IncrementAsync(object version, IVersionType versionType, ISessionImplementor session, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            object next = await(versionType.NextAsync(version, session, cancellationToken)).ConfigureAwait(false);

            if (log.IsDebugEnabled())
            {
                log.Debug("Incrementing: {0} to {1}",
                          versionType.ToLoggableString(version, session.Factory),
                          versionType.ToLoggableString(next, session.Factory));
            }
            return(next);
        }