다음을 통해 공유


IDbTransactionInterceptor.TransactionStartedAsync 메서드

정의

EF가 를 호출한 직후 호출 BeginTransactionAsync(IsolationLevel, CancellationToken)합니다.

public System.Threading.Tasks.Task<System.Data.Common.DbTransaction> TransactionStartedAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData eventData, System.Data.Common.DbTransaction result, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction> TransactionStartedAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData eventData, System.Data.Common.DbTransaction result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction> TransactionStartedAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData eventData, System.Data.Common.DbTransaction result, System.Threading.CancellationToken cancellationToken = default);
abstract member TransactionStartedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.Common.DbTransaction>
abstract member TransactionStartedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
abstract member TransactionStartedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
override this.TransactionStartedAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionEndEventData * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
Public Function TransactionStartedAsync (connection As DbConnection, eventData As TransactionEndEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DbTransaction)
Public Function TransactionStartedAsync (connection As DbConnection, eventData As TransactionEndEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of DbTransaction)
Public Overridable Function TransactionStartedAsync (connection As DbConnection, eventData As TransactionEndEventData, result As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of DbTransaction)

매개 변수

connection
DbConnection

연결입니다.

eventData
TransactionEndEventData

연결 및 트랜잭션에 대한 컨텍스트 정보입니다.

result
DbTransaction

에 대한 호출의 결과입니다 BeginTransactionAsync(IsolationLevel, CancellationToken). 이 값은 일반적으로이 메서드의 구현에 대 한 반환 값으로 사용 합니다.

cancellationToken
CancellationToken

CancellationToken 작업이 완료 될 때까지 기다리는 동안 관찰할 입니다.

반환

Task EF에서 사용할 결과를 제공하는 입니다. 결과를 변경하려고 하지 않는 인터셉터에 대해 이 메서드를 구현하는 것은 전달된 값을 반환 result 하는 것입니다( 종종 사용). FromResult<TResult>(TResult)

예외

설명

이 메서드는 인터셉터에서 생성을 표시하지 않은 경우에도 계속 호출됩니다 TransactionStarting(DbConnection, TransactionStartingEventData, InterceptionResult<DbTransaction>). 이 경우 는 result 에서 반환 TransactionStarting(DbConnection, TransactionStartingEventData, InterceptionResult<DbTransaction>)된 결과입니다.

적용 대상