DatabaseFacade.AutoTransactionBehavior Property

Definition

Gets or sets a value indicating whether or not a transaction will be created automatically by SaveChanges() if neither 'BeginTransaction' nor 'UseTransaction' has been called.

C#
public virtual Microsoft.EntityFrameworkCore.AutoTransactionBehavior AutoTransactionBehavior { get; set; }

Property Value

Remarks

The default setting is WhenNeeded.

Setting this to Never 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

Product Versions
Entity Framework Core 7.0, 8.0, 9.0