コード例 #1
0
 /// <summary>
 ///     <para>
 ///         Called at the end of <see cref="O:DbContext.SaveChanges" />.
 ///     </para>
 ///     <para>
 ///         This method is still called if an interceptor suppressed creation of a command in
 ///         <see cref="ISaveChangesInterceptor.SavingChanges" />.
 ///         In this case, <paramref name="result" /> is the result returned by <see cref="ISaveChangesInterceptor.SavingChanges" />.
 ///     </para>
 /// </summary>
 /// <param name="eventData">Contextual information about the <see cref="DbContext" /> being used.</param>
 /// <param name="result">
 ///     The result of the call to <see cref="O:DbContext.SaveChanges" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     The result that EF will use.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual int SavedChanges(SaveChangesCompletedEventData eventData, int result)
 => result;
コード例 #2
0
 /// <summary>
 ///     <para>
 ///         Called at the end of <see cref="M:DbContext.SaveChangesAsync" />.
 ///     </para>
 ///     <para>
 ///         This method is still called if an interceptor suppressed creation of a command in <see cref="ISaveChangesInterceptor.SavingChangesAsync" />.
 ///         In this case, <paramref name="result" /> is the result returned by <see cref="ISaveChangesInterceptor.SavingChangesAsync" />.
 ///     </para>
 /// </summary>
 /// <param name="eventData"> Contextual information about the <see cref="DbContext"/> being used. </param>
 /// <param name="result">
 ///     The result of the call to <see cref="M:DbContext.SaveChangesAsync" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     The result that EF will use.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual ValueTask <int> SavedChangesAsync(
     SaveChangesCompletedEventData eventData,
     int result,
     CancellationToken cancellationToken = default)
 => new ValueTask <int>(result);