IDbContextTransactionManager 介面
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立並管理目前的交易。
此介面通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。
public interface IDbContextTransactionManager
public interface IDbContextTransactionManager : Microsoft.EntityFrameworkCore.Infrastructure.IResettableService
type IDbContextTransactionManager = interface
type IDbContextTransactionManager = interface
interface IResettableService
Public Interface IDbContextTransactionManager
Public Interface IDbContextTransactionManager
Implements IResettableService
- 衍生
- 實作
備註
服役期間為 Scoped。 這表示每個 DbContext 實例都會使用自己的服務實例。 實作方式可能取決於其他註冊於任何生命週期的服務。 實作不需要執行緒安全。
更多資訊與範例請參閱 EF Core 中資料庫提供者與擴充與交易的實作。
屬性
| 名稱 | Description |
|---|---|
| CurrentTransaction |
取得目前的交易。 |
方法
| 名稱 | Description |
|---|---|
| BeginTransaction() |
開始一筆新交易。 |
| BeginTransactionAsync(CancellationToken) |
非同步開始新交易。 |
| CommitTransaction() |
將目前交易中對資料庫的所有變更提交。 |
| CommitTransactionAsync(CancellationToken) |
將目前交易中對資料庫的所有變更提交。 |
| ResetState() |
重置服務,讓它能從池中使用。 (繼承來源 IResettableService) |
| ResetStateAsync(CancellationToken) |
重置服務,讓它能從池中使用。 (繼承來源 IResettableService) |
| RollbackTransaction() |
丟棄目前交易中資料庫的所有變更。 |
| RollbackTransactionAsync(CancellationToken) |
丟棄目前交易中資料庫的所有變更。 |