Share via


DatabaseFacade.AutoTransactionsEnabled Property

Definition

Caution

Use EnableAutoTransactions instead

Caution

Use AutoTransactionBehavior instead

Gets or sets a value indicating whether or not a transaction will be created automatically by SaveChanges() if none of the 'BeginTransaction' or 'UseTransaction' methods have been called.

public virtual bool AutoTransactionsEnabled { get; set; }
[System.Obsolete("Use EnableAutoTransactions instead")]
public virtual bool AutoTransactionsEnabled { get; set; }
[System.Obsolete("Use AutoTransactionBehavior instead")]
public virtual bool AutoTransactionsEnabled { get; set; }
member this.AutoTransactionsEnabled : bool with get, set
[<System.Obsolete("Use EnableAutoTransactions instead")>]
member this.AutoTransactionsEnabled : bool with get, set
[<System.Obsolete("Use AutoTransactionBehavior instead")>]
member this.AutoTransactionsEnabled : bool with get, set
Public Overridable Property AutoTransactionsEnabled As Boolean

Property Value

Attributes

Remarks

Setting this value to false will also disable the IExecutionStrategy for SaveChanges()

The default value is true, meaning that SaveChanges() will always use a transaction when saving changes.

Setting this value to false should only be done with caution, since the database could be left in an inconsistent state if failure occurs.

See Transactions in EF Core for more information and examples.

Applies to