Class TransactionSettings
- Namespace
- Breeze.Persistence
- Assembly
- Breeze.Persistence.dll
How a save should be wrapped in a transaction: which kind, at what isolation level, and with what timeout.
public class TransactionSettings
- Inheritance
-
TransactionSettings
- Inherited Members
Remarks
The transaction spans BeforeSaveEntities, the save itself and AfterSaveEntities, so all of them commit or roll back together. Settings come from Default unless a save passes its own.
Constructors
TransactionSettings()
Create a TransactionSettings object using default settings.
public TransactionSettings()
Remarks
Defaults the IsolationLevel to ReadCommitted,
the Timeout to TransactionManager.DefaultTimeout (which is usually 1 minute),
and TransactionType to TransactionType.None (which means the other settings have no effect).
These settings are not Breeze requirements and can be changed using the appropriate constructor or setter.
TransactionSettings(IsolationLevel, TimeSpan, TransactionType)
Create a TransactionSettings object with the specified settings.
public TransactionSettings(IsolationLevel isolationLevel, TimeSpan timeout, TransactionType transactionType)
Parameters
isolationLevelIsolationLeveltimeoutTimeSpantransactionTypeTransactionType
Remarks
Note that IsolationLevel and Timeout have no affect if TransactionType is None.
Properties
Default
Default settings for all saves.
[AllowNull]
public static TransactionSettings Default { get; set; }
Property Value
Remarks
The Default provides default transaction settings for all SaveChanges actions.
Override BreezeConfig to return a different TransactionSettings value.
You can supply settings for a particular save with the TransactionSettings passed in the SaveChanges call.
Setting it to null restores the default settings.
IsolationLevel
Gets the transaction locking behavior.
public IsolationLevel IsolationLevel { get; set; }
Property Value
Remarks
Only applicable if <xref href="Breeze.Persistence.TransactionSettings.TransactionType" data-throw-if-not-resolved="false"></xref> is not
None
. The default IsolationLevel is ReadCommitted.
IsolationLevelAs
Gets the transaction locking behavior as a System.Data.IsolationLevel.
public IsolationLevel IsolationLevelAs { get; }
Property Value
Remarks
Only applicable if <xref href="Breeze.Persistence.TransactionSettings.TransactionType" data-throw-if-not-resolved="false"></xref> is not
None
. The default IsolationLevel is ReadCommitted.
Timeout
Gets the timeout period for the TransactionScope transaction.
public TimeSpan Timeout { get; set; }
Property Value
Remarks
Only applicable if <xref href="Breeze.Persistence.TransactionSettings.TransactionType" data-throw-if-not-resolved="false"></xref> is
TransactionScope
. The default Timeout is TransactionManager.DefaultTimeout which is usually 1 minute. See http://stackoverflow.com/questions/6402031/transactionscope-maximumtimeout
TransactionType
What type of transaction to use when performing saves. The transaction wraps the BeforeSaveEntity/ies, SaveChangesCore, and AfterSaveEntities methods so all work can be commited or rolled back together.
public TransactionType TransactionType { get; set; }
Property Value
Methods
Equals(object?)
See Equals(object).
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
See GetHashCode().
public override int GetHashCode()
Returns
ToTransactionOptions()
Converts the TransactionSettings to a TransactionOptions instance.
public TransactionOptions ToTransactionOptions()