Skip to content

Commit

Permalink
Add OperationCancellationException docs everywhere (#23686)
Browse files Browse the repository at this point in the history
And make cancellation token parameter docs consistent

Closes #19151
  • Loading branch information
roji authored Dec 16, 2020
1 parent 1c5d2ed commit fcef180
Show file tree
Hide file tree
Showing 58 changed files with 758 additions and 1,003 deletions.
1 change: 1 addition & 0 deletions src/EFCore.Abstractions/Infrastructure/ILazyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void SetLoaded(
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <param name="navigationName"> The navigation property name. </param>
/// <returns> A task that represents the asynchronous operation. </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
#pragma warning disable CA1068 // CancellationToken parameters must come last
Task LoadAsync(
#pragma warning restore CA1068 // CancellationToken parameters must come last
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public virtual void ResetState()
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
public virtual Task ResetStateAsync(CancellationToken cancellationToken = default)
{
ResetState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public virtual void ResetState()
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
public virtual Task ResetStateAsync(CancellationToken cancellationToken = default)
{
ResetState();
Expand Down
22 changes: 15 additions & 7 deletions src/EFCore.Relational/Diagnostics/DbCommandInterceptor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -143,14 +144,15 @@ public virtual InterceptionResult<int> NonQueryExecuting(
/// interceptor suppressed execution by calling <see cref="InterceptionResult{DbDataReader}.SuppressWithResult" />.
/// This value is typically used as the return value for the implementation of this method.
/// </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns>
/// If <see cref="InterceptionResult{DbDataReader}.HasResult" /> is false, the EF will continue as normal.
/// If <see cref="InterceptionResult{DbDataReader}.HasResult" /> is true, then EF will suppress the operation it
/// was about to perform and use <see cref="InterceptionResult{DbDataReader}.Result" /> instead.
/// 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, often using <see cref="Task.FromResult{TResult}" />
/// </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual ValueTask<InterceptionResult<DbDataReader>> ReaderExecutingAsync(
DbCommand command,
CommandEventData eventData,
Expand All @@ -169,14 +171,15 @@ public virtual ValueTask<InterceptionResult<DbDataReader>> ReaderExecutingAsync(
/// interceptor suppressed execution by calling <see cref="InterceptionResult{Object}.SuppressWithResult" />.
/// This value is typically used as the return value for the implementation of this method.
/// </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns>
/// If <see cref="InterceptionResult{Object}.HasResult" /> is false, the EF will continue as normal.
/// If <see cref="InterceptionResult{Object}.HasResult" /> is true, then EF will suppress the operation it
/// was about to perform and use <see cref="InterceptionResult{Object}.Result" /> instead.
/// 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, often using <see cref="Task.FromResult{TResult}" />
/// </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual ValueTask<InterceptionResult<object>> ScalarExecutingAsync(
DbCommand command,
CommandEventData eventData,
Expand All @@ -195,14 +198,15 @@ public virtual ValueTask<InterceptionResult<object>> ScalarExecutingAsync(
/// interceptor suppressed execution by calling <see cref="InterceptionResult{Int32}.SuppressWithResult" />.
/// This value is typically used as the return value for the implementation of this method.
/// </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns>
/// If <see cref="InterceptionResult{Int32}.HasResult" /> is false, the EF will continue as normal.
/// If <see cref="InterceptionResult{Int32}.HasResult" /> is true, then EF will suppress the operation it
/// was about to perform and use <see cref="InterceptionResult{Int32}.Result" /> instead.
/// 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, often using <see cref="Task.FromResult{TResult}" />
/// </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual ValueTask<InterceptionResult<int>> NonQueryExecutingAsync(
DbCommand command,
CommandEventData eventData,
Expand Down Expand Up @@ -303,12 +307,13 @@ public virtual int NonQueryExecuted(
/// The result of the call to <see cref="DbCommand.ExecuteReaderAsync()" />.
/// This value is typically used as the return value for the implementation of this method.
/// </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns>
/// A <see cref="Task" /> providing 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, often using <see cref="Task.FromResult{TResult}" />
/// </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual ValueTask<DbDataReader> ReaderExecutedAsync(
DbCommand command,
CommandExecutedEventData eventData,
Expand All @@ -331,12 +336,13 @@ public virtual ValueTask<DbDataReader> ReaderExecutedAsync(
/// The result of the call to <see cref="DbCommand.ExecuteScalarAsync()" />.
/// This value is typically used as the return value for the implementation of this method.
/// </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns>
/// A <see cref="Task" /> providing 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, often using <see cref="Task.FromResult{TResult}" />
/// </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual ValueTask<object> ScalarExecutedAsync(
DbCommand command,
CommandExecutedEventData eventData,
Expand All @@ -359,12 +365,13 @@ public virtual ValueTask<object> ScalarExecutedAsync(
/// The result of the call to <see cref="DbCommand.ExecuteNonQueryAsync()" />.
/// This value is typically used as the return value for the implementation of this method.
/// </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns>
/// A <see cref="Task" /> providing 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, often using <see cref="Task.FromResult{TResult}" />
/// </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual ValueTask<int> NonQueryExecutedAsync(
DbCommand command,
CommandExecutedEventData eventData,
Expand All @@ -388,8 +395,9 @@ public virtual void CommandFailed(
/// </summary>
/// <param name="command"> The command. </param>
/// <param name="eventData"> Contextual information about the command and execution. </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns> A <see cref="Task" /> representing the asynchronous operation. </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual Task CommandFailedAsync(
DbCommand command,
CommandErrorEventData eventData,
Expand Down
10 changes: 7 additions & 3 deletions src/EFCore.Relational/Diagnostics/DbConnectionInterceptor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -50,14 +51,15 @@ public virtual InterceptionResult ConnectionOpening(
/// interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress" />.
/// This value is typically used as the return value for the implementation of this method.
/// </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns>
/// If <see cref="InterceptionResult.IsSuppressed" /> is false, the EF will continue as normal.
/// If <see cref="InterceptionResult.IsSuppressed" /> is true, then EF will suppress the operation
/// it was about to perform.
/// A normal implementation of this method for any interceptor that is not attempting to suppress
/// the operation is to return the <paramref name="result" /> value passed in.
/// </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual ValueTask<InterceptionResult> ConnectionOpeningAsync(
DbConnection connection,
ConnectionEventData eventData,
Expand All @@ -79,8 +81,9 @@ public virtual void ConnectionOpened(DbConnection connection, ConnectionEndEvent
/// </summary>
/// <param name="connection"> The connection. </param>
/// <param name="eventData"> Contextual information about the connection. </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns> A <see cref="Task" /> representing the asynchronous operation. </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual Task ConnectionOpenedAsync(
DbConnection connection,
ConnectionEndEventData eventData,
Expand Down Expand Up @@ -173,8 +176,9 @@ public virtual void ConnectionFailed(
/// </summary>
/// <param name="connection"> The connection. </param>
/// <param name="eventData"> Contextual information about the connection. </param>
/// <param name="cancellationToken"> The cancellation token. </param>
/// <param name="cancellationToken"> A <see cref="CancellationToken" /> to observe while waiting for the task to complete. </param>
/// <returns> A <see cref="Task" /> representing the asynchronous operation. </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
public virtual Task ConnectionFailedAsync(
DbConnection connection,
ConnectionErrorEventData eventData,
Expand Down
Loading

0 comments on commit fcef180

Please sign in to comment.