Click or drag to resize

TransactionContext Class

A context for a group of transactions in the software transactional memory (STM) system. Different contexts can be thought of as separate in-memory databases. A TransactedPropertyT exists within exactly one context and can only be read or modified by a Transaction within the same context.
Inheritance Hierarchy
SystemObject
  AGI.FoundationTransactionContext

Namespace:  AGI.Foundation
Assembly:  AGI.Foundation.Tracking (in AGI.Foundation.Tracking.dll) Version: 24.1.418.0 (24.1.418.0)
Syntax
public class TransactionContext

The TransactionContext type exposes the following members.

Constructors
  NameDescription
Public methodTransactionContext
Initializes a new instance.
Top
Methods
  NameDescription
Public methodDoTransactionally
Executes the provided callback within a transaction, and automatically commits the transaction when the callback returns. If the transaction conflicts (it raises a TransactionConflictException), the callback is executed again with a new transaction. This process continues until the transaction commits successfully.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSelectTransactionallyTResult
Executes the provided callback within a transaction, and automatically commits the transaction when the callback returns. If the transaction conflicts (it raises a TransactionConflictException), the callback is executed again with a new transaction. This process continues until the transaction commits successfully. When the transaction commits successfully, the value returned by the provided callback is returned by this method.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Events
  NameDescription
Public eventCommitted
Raised each time that a transaction is committed in this context.
Top
Remarks
The software transactional memory (STM) implementation uses multiversion concurrency control to achieve snapshot isolation for in-memory properties and collections. Conceptually, a snapshot of the entire TransactionContext is taken when a new Transaction is constructed. All reads of transacted properties or collections will see the snapshot values, even if the values are changed by another transaction in the meantime. When transacted properties or collections are modified within a collection, those modifications are not visible to any other transaction until the first transaction is committed with a call to Commit. If another transaction has modified the same properties or collections, the committing transaction will raise a TransactionConflictException and the transaction must be retried. Read-only transactions will never block, nor will they conflict with other transactions.
See Also