Język

DatabaseFacade.AutoTransactionsEnabled Właściwość

Definicja

Uwaga

Use AutoTransactionBehavior instead

Uwaga

Use EnableAutoTransactions instead

Pobiera lub ustawia wartość wskazującą, czy transakcja zostanie utworzona automatycznie, SaveChanges() jeśli żadna z metod "BeginTransaction" lub "UseTransaction" nie została wywołana.

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

Wartość właściwości

Atrybuty

Uwagi

Ustawienie tej wartości na false spowoduje również wyłączenie parametru IExecutionStrategySaveChanges()

Wartość domyślna to true, co oznacza, że SaveChanges() zawsze będzie używać transakcji podczas zapisywania zmian.

Ustawienie tej wartości false na wartość powinno być wykonywane tylko z ostrożnością, ponieważ baza danych może pozostać w niespójnym stanie, jeśli wystąpi awaria.

Aby uzyskać więcej informacji i przykładów, zobacz Transakcje w programie EF Core .

Dotyczy