Skip to content

Commit

Permalink
IC
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Jul 19, 2019
1 parent d0afefc commit ed67046
Show file tree
Hide file tree
Showing 17 changed files with 394 additions and 309 deletions.
28 changes: 14 additions & 14 deletions src/EFCore.Relational/Diagnostics/DbCommandInterceptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public abstract class DbCommandInterceptor : IDbCommandInterceptor
/// 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 InterceptionResult<DbDataReader>? ReaderExecuting(
public virtual InterceptionResult<DbDataReader> ReaderExecuting(
DbCommand command,
CommandEventData eventData,
InterceptionResult<DbDataReader>? result)
InterceptionResult<DbDataReader> result)
{
return result;
}
Expand All @@ -59,10 +59,10 @@ public abstract class DbCommandInterceptor : IDbCommandInterceptor
/// 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 InterceptionResult<object>? ScalarExecuting(
public virtual InterceptionResult<object> ScalarExecuting(
DbCommand command,
CommandEventData eventData,
InterceptionResult<object>? result) => result;
InterceptionResult<object> result) => result;

/// <summary>
/// Called just before EF intends to call <see cref="DbCommand.ExecuteNonQuery()" />.
Expand All @@ -82,10 +82,10 @@ public abstract class DbCommandInterceptor : IDbCommandInterceptor
/// 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 InterceptionResult<int>? NonQueryExecuting(
public virtual InterceptionResult<int> NonQueryExecuting(
DbCommand command,
CommandEventData eventData,
InterceptionResult<int>? result)
InterceptionResult<int> result)
=> result;

/// <summary>
Expand All @@ -107,10 +107,10 @@ public abstract class DbCommandInterceptor : IDbCommandInterceptor
/// 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>
public virtual Task<InterceptionResult<DbDataReader>?> ReaderExecutingAsync(
public virtual Task<InterceptionResult<DbDataReader>> ReaderExecutingAsync(
DbCommand command,
CommandEventData eventData,
InterceptionResult<DbDataReader>? result,
InterceptionResult<DbDataReader> result,
CancellationToken cancellationToken = default)
=> Task.FromResult(result);

Expand All @@ -133,10 +133,10 @@ public abstract class DbCommandInterceptor : IDbCommandInterceptor
/// 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>
public virtual Task<InterceptionResult<object>?> ScalarExecutingAsync(
public virtual Task<InterceptionResult<object>> ScalarExecutingAsync(
DbCommand command,
CommandEventData eventData,
InterceptionResult<object>? result,
InterceptionResult<object> result,
CancellationToken cancellationToken = default)
=> Task.FromResult(result);

Expand All @@ -159,10 +159,10 @@ public abstract class DbCommandInterceptor : IDbCommandInterceptor
/// 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>
public virtual Task<InterceptionResult<int>?> NonQueryExecutingAsync(
public virtual Task<InterceptionResult<int>> NonQueryExecutingAsync(
DbCommand command,
CommandEventData eventData,
InterceptionResult<int>? result,
InterceptionResult<int> result,
CancellationToken cancellationToken = default)
=> Task.FromResult(result);

Expand Down Expand Up @@ -369,10 +369,10 @@ public virtual Task CommandFailedAsync(
/// 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 InterceptionResult? DataReaderDisposing(
public virtual InterceptionResult DataReaderDisposing(
DbCommand command,
DataReaderDisposingEventData eventData,
InterceptionResult? result)
InterceptionResult result)
=> result;
}
}
16 changes: 8 additions & 8 deletions src/EFCore.Relational/Diagnostics/DbConnectionInterceptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public abstract class DbConnectionInterceptor : IDbConnectionInterceptor
/// 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 InterceptionResult? ConnectionOpening(
public virtual InterceptionResult ConnectionOpening(
DbConnection connection,
ConnectionEventData eventData,
InterceptionResult? result)
InterceptionResult result)
=> result;

/// <summary>
Expand All @@ -56,10 +56,10 @@ public abstract class DbConnectionInterceptor : IDbConnectionInterceptor
/// 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>
public virtual Task<InterceptionResult?> ConnectionOpeningAsync(
public virtual Task<InterceptionResult> ConnectionOpeningAsync(
DbConnection connection,
ConnectionEventData eventData,
InterceptionResult? result,
InterceptionResult result,
CancellationToken cancellationToken = default)
=> Task.FromResult(result);

Expand Down Expand Up @@ -102,10 +102,10 @@ public virtual Task ConnectionOpenedAsync(
/// 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 InterceptionResult? ConnectionClosing(
public virtual InterceptionResult ConnectionClosing(
DbConnection connection,
ConnectionEventData eventData,
InterceptionResult? result)
InterceptionResult result)
=> result;

/// <summary>
Expand All @@ -125,10 +125,10 @@ public virtual Task ConnectionOpenedAsync(
/// 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>
public virtual Task<InterceptionResult?> ConnectionClosingAsync(
public virtual Task<InterceptionResult> ConnectionClosingAsync(
DbConnection connection,
ConnectionEventData eventData,
InterceptionResult? result)
InterceptionResult result)
=> Task.FromResult(result);

/// <summary>
Expand Down
24 changes: 12 additions & 12 deletions src/EFCore.Relational/Diagnostics/DbTransactionInterceptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public abstract class DbTransactionInterceptor : IDbTransactionInterceptor
/// 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 InterceptionResult<DbTransaction>? TransactionStarting(
public virtual InterceptionResult<DbTransaction> TransactionStarting(
DbConnection connection,
TransactionStartingEventData eventData,
InterceptionResult<DbTransaction>? result)
InterceptionResult<DbTransaction> result)
=> result;

/// <summary>
Expand Down Expand Up @@ -85,8 +85,8 @@ public virtual DbTransaction TransactionStarted(
/// 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>
public virtual Task<InterceptionResult<DbTransaction>?> TransactionStartingAsync(
DbConnection connection, TransactionStartingEventData eventData, InterceptionResult<DbTransaction>? result,
public virtual Task<InterceptionResult<DbTransaction>> TransactionStartingAsync(
DbConnection connection, TransactionStartingEventData eventData, InterceptionResult<DbTransaction> result,
CancellationToken cancellationToken = default)
=> Task.FromResult(result);

Expand Down Expand Up @@ -179,10 +179,10 @@ public virtual Task<DbTransaction> TransactionUsedAsync(
/// 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 InterceptionResult? TransactionCommitting(
public virtual InterceptionResult TransactionCommitting(
DbTransaction transaction,
TransactionEventData eventData,
InterceptionResult? result)
InterceptionResult result)
=> result;

/// <summary>
Expand Down Expand Up @@ -214,10 +214,10 @@ public virtual void TransactionCommitted(
/// 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>
public virtual Task<InterceptionResult?> TransactionCommittingAsync(
public virtual Task<InterceptionResult> TransactionCommittingAsync(
DbTransaction transaction,
TransactionEventData eventData,
InterceptionResult? result,
InterceptionResult result,
CancellationToken cancellationToken = default)
=> Task.FromResult(result);

Expand Down Expand Up @@ -251,10 +251,10 @@ public virtual Task TransactionCommittedAsync(
/// 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 InterceptionResult? TransactionRollingBack(
public virtual InterceptionResult TransactionRollingBack(
DbTransaction transaction,
TransactionEventData eventData,
InterceptionResult? result)
InterceptionResult result)
=> result;

/// <summary>
Expand Down Expand Up @@ -286,10 +286,10 @@ public virtual void TransactionRolledBack(
/// 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>
public virtual Task<InterceptionResult?> TransactionRollingBackAsync(
public virtual Task<InterceptionResult> TransactionRollingBackAsync(
DbTransaction transaction,
TransactionEventData eventData,
InterceptionResult? result,
InterceptionResult result,
CancellationToken cancellationToken = default)
=> Task.FromResult(result);

Expand Down
41 changes: 21 additions & 20 deletions src/EFCore.Relational/Diagnostics/IDbCommandInterceptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,23 @@ public interface IDbCommandInterceptor : IInterceptor
/// <param name="command"> The command. </param>
/// <param name="eventData"> Contextual information about the command and execution. </param>
/// <param name="result">
/// The current result, or null if no result yet exists.
/// This value will be non-null if some previous interceptor suppressed execution by returning a result from
/// its implementation of this method.
/// Represents the current result if one exists.
/// This value will have <see cref="InterceptionResult{TResult}.HasResult"/> set to true if some previous
/// interceptor suppressed execution by calling <see cref="InterceptionResult{TResult}.SuppressWithResult"/>
/// and returning the value from its implementation of this method.
/// This value is typically used as the return value for the implementation of this method.
/// </param>
/// <returns>
/// If null, then EF will execute the command as normal.
/// If non-null, then command execution is suppressed and the value contained in
/// the <see cref="InterceptionResult{TResult}" /> we be used by EF instead.
/// If <see cref="InterceptionResult{TResult}.HasResult"/> is false, the EF will continue as normal.
/// If <see cref="InterceptionResult{TResult}.HasResult"/> is true, then EF will suppress execution
/// and use <see cref="InterceptionResult{TResult}.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.
/// </returns>
InterceptionResult<DbDataReader>? ReaderExecuting(
InterceptionResult<DbDataReader> ReaderExecuting(
[NotNull] DbCommand command,
[NotNull] CommandEventData eventData,
InterceptionResult<DbDataReader>? result);
InterceptionResult<DbDataReader> result);

/// <summary>
/// Called just before EF intends to call <see cref="DbCommand.ExecuteScalar()" />.
Expand All @@ -72,10 +73,10 @@ public interface IDbCommandInterceptor : IInterceptor
/// 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>
InterceptionResult<object>? ScalarExecuting(
InterceptionResult<object> ScalarExecuting(
[NotNull] DbCommand command,
[NotNull] CommandEventData eventData,
InterceptionResult<object>? result);
InterceptionResult<object> result);

/// <summary>
/// Called just before EF intends to call <see cref="DbCommand.ExecuteNonQuery()" />.
Expand All @@ -95,10 +96,10 @@ public interface IDbCommandInterceptor : IInterceptor
/// 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>
InterceptionResult<int>? NonQueryExecuting(
InterceptionResult<int> NonQueryExecuting(
[NotNull] DbCommand command,
[NotNull] CommandEventData eventData,
InterceptionResult<int>? result);
InterceptionResult<int> result);

/// <summary>
/// Called just before EF intends to call <see cref="DbCommand.ExecuteReaderAsync()" />.
Expand All @@ -119,10 +120,10 @@ public interface IDbCommandInterceptor : IInterceptor
/// 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>
Task<InterceptionResult<DbDataReader>?> ReaderExecutingAsync(
Task<InterceptionResult<DbDataReader>> ReaderExecutingAsync(
[NotNull] DbCommand command,
[NotNull] CommandEventData eventData,
InterceptionResult<DbDataReader>? result,
InterceptionResult<DbDataReader> result,
CancellationToken cancellationToken = default);

/// <summary>
Expand All @@ -144,10 +145,10 @@ public interface IDbCommandInterceptor : IInterceptor
/// 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>
Task<InterceptionResult<object>?> ScalarExecutingAsync(
Task<InterceptionResult<object>> ScalarExecutingAsync(
[NotNull] DbCommand command,
[NotNull] CommandEventData eventData,
InterceptionResult<object>? result,
InterceptionResult<object> result,
CancellationToken cancellationToken = default);

/// <summary>
Expand All @@ -169,10 +170,10 @@ public interface IDbCommandInterceptor : IInterceptor
/// 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>
Task<InterceptionResult<int>?> NonQueryExecutingAsync(
Task<InterceptionResult<int>> NonQueryExecutingAsync(
[NotNull] DbCommand command,
[NotNull] CommandEventData eventData,
InterceptionResult<int>? result,
InterceptionResult<int> result,
CancellationToken cancellationToken = default);

/// <summary>
Expand Down Expand Up @@ -369,9 +370,9 @@ Task CommandFailedAsync(
/// 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>
InterceptionResult? DataReaderDisposing(
InterceptionResult DataReaderDisposing(
[NotNull] DbCommand command,
[NotNull] DataReaderDisposingEventData eventData,
InterceptionResult? result);
InterceptionResult result);
}
}
Loading

0 comments on commit ed67046

Please sign in to comment.