AutoTransactionBehavior Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Indicates whether a transaction will be created automatically by SaveChanges() if a user transaction wasn't created via 'BeginTransaction' or provided via 'UseTransaction'.
public enum AutoTransactionBehavior
type AutoTransactionBehavior =
Public Enum AutoTransactionBehavior
- Inheritance
-
AutoTransactionBehavior
Fields
Name | Value | Description |
---|---|---|
WhenNeeded | 0 | Transactions are automatically created as needed. For example, most single SQL statements are implicitly executed within a transaction, and so do not require an explicit one to be created, reducing database round trips. This is the default setting. |
Always | 1 | Transactions are always created automatically, as long there's no user transaction. This setting may create transactions even when they're not needed, adding additional database round trips which may degrade performance. |
Never | 2 | Transactions are never created automatically. Use this options with caution, since the database could be left in an inconsistent state if a failure occurs. |