DbTransactionInterceptor.TransactionUsedAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
调用 后 RelationalDatabaseFacadeExtensions.UseTransactionAsync 立即调用 。
public virtual System.Threading.Tasks.Task<System.Data.Common.DbTransaction> TransactionUsedAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionEventData eventData, System.Data.Common.DbTransaction result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction> TransactionUsedAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionEventData eventData, System.Data.Common.DbTransaction result, System.Threading.CancellationToken cancellationToken = default);
abstract member TransactionUsedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbTransaction>
override this.TransactionUsedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbTransaction>
abstract member TransactionUsedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
override this.TransactionUsedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
Public Overridable Function TransactionUsedAsync (connection As DbConnection, eventData As TransactionEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DbTransaction)
Public Overridable Function TransactionUsedAsync (connection As DbConnection, eventData As TransactionEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of DbTransaction)
参数
- connection
- DbConnection
连接。
- eventData
- TransactionEventData
有关连接和事务的上下文信息。
- result
- DbTransaction
DbTransaction传递给 的 RelationalDatabaseFacadeExtensions.UseTransactionAsync。 此值通常用作此方法实现的返回值。
- cancellationToken
- CancellationToken
等待 CancellationToken 任务完成时要观察的 。
返回
一个 Task 包含将用作有效值的值,该值传递给 RelationalDatabaseFacadeExtensions.UseTransactionAsync 任何未尝试更改结果的侦听器的此方法的正常实现是返回 result
传入的值,通常使用 FromResult<TResult>(TResult)