共用方式為


IDbTransactionInterceptor.TransactionUsedAsync 方法

定義

在呼叫 之後 RelationalDatabaseFacadeExtensions.UseTransactionAsync 立即呼叫。

public 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 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);
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>
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>
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 Function TransactionUsedAsync (connection As DbConnection, eventData As TransactionEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DbTransaction)
Public Function TransactionUsedAsync (connection As DbConnection, eventData As TransactionEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(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)

例外狀況

適用於