IDbTransactionInterceptor.TransactionStarting 方法

定义

在 EF 打算调用 之前调用 BeginTransaction(IsolationLevel)

public Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> TransactionStarting (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> result);
public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> TransactionStarting (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> result);
abstract member TransactionStarting : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>
abstract member TransactionStarting : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>
override this.TransactionStarting : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.TransactionStartingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbTransaction>
Public Function TransactionStarting (connection As DbConnection, eventData As TransactionStartingEventData, result As InterceptionResult(Of DbTransaction)) As InterceptionResult(Of DbTransaction)
Public Overridable Function TransactionStarting (connection As DbConnection, eventData As TransactionStartingEventData, result As InterceptionResult(Of DbTransaction)) As InterceptionResult(Of DbTransaction)

参数

connection
DbConnection

连接。

eventData
TransactionStartingEventData

有关连接和事务的上下文信息。

result
InterceptionResult<DbTransaction>

表示当前结果(如果存在)。 如果某个以前的侦听器通过调用 SuppressWithResult(TResult)来禁止执行,则此值将HasResult设置为 true 。 此值通常用作此方法实现的返回值。

返回

如果 HasResult 为 false,EF 将照常继续。 如果 HasResult 为 true,则 EF 将取消它要执行的操作并改为使用 Result 。 对于任何不尝试更改结果的侦听器,此方法的实现是返回 result 传入的值,通常使用 FromResult<TResult>(TResult)

适用于