DatabaseFacade.AutoTransactionBehavior 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
若未呼叫「BeginTransaction」或「UseTransaction」,會取得或設定一個值,表示交易是否會自動 SaveChanges() 建立。
public virtual Microsoft.EntityFrameworkCore.AutoTransactionBehavior AutoTransactionBehavior { get; set; }
member this.AutoTransactionBehavior : Microsoft.EntityFrameworkCore.AutoTransactionBehavior with get, set
Public Overridable Property AutoTransactionBehavior As AutoTransactionBehavior
屬性值
備註
預設設定是 WhenNeeded。
設定為 Never 此時需謹慎,因為若發生故障,資料庫可能會處於不一致狀態。
更多資訊與範例請參閱 EF Core 中的交易 。