共用方式為


RelationalConnection.UseTransaction 方法

定義

多載

UseTransaction(DbTransaction, Guid)

指定要用於資料庫作業的現有 DbTransaction

UseTransaction(DbTransaction)

指定要用於資料庫作業的現有 DbTransaction

UseTransaction(DbTransaction, Guid)

指定要用於資料庫作業的現有 DbTransaction

public virtual Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction UseTransaction (System.Data.Common.DbTransaction transaction, Guid transactionId);
public virtual Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction? UseTransaction (System.Data.Common.DbTransaction? transaction, Guid transactionId);
abstract member UseTransaction : System.Data.Common.DbTransaction * Guid -> Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction
override this.UseTransaction : System.Data.Common.DbTransaction * Guid -> Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction
Public Overridable Function UseTransaction (transaction As DbTransaction, transactionId As Guid) As IDbContextTransaction

參數

transaction
DbTransaction

要使用的交易。

transactionId
Guid

交易的唯一識別碼。

傳回

會包裝所提供交易的 IDbContextTransaction 實例,如果 為 ,則 transactionnullnull

實作

適用於

UseTransaction(DbTransaction)

指定要用於資料庫作業的現有 DbTransaction

public virtual Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction UseTransaction (System.Data.Common.DbTransaction transaction);
public virtual Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction? UseTransaction (System.Data.Common.DbTransaction? transaction);
abstract member UseTransaction : System.Data.Common.DbTransaction -> Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction
override this.UseTransaction : System.Data.Common.DbTransaction -> Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction
Public Overridable Function UseTransaction (transaction As DbTransaction) As IDbContextTransaction

參數

transaction
DbTransaction

要使用的交易。

傳回

IDbTransaction 實例,會包裝提供的交易。

實作

適用於