CalculationWorks Logo
BcfTransaction ClassCalculationWorks BCF Library 1.1 for .NET Framework 4.5

[This is preliminary documentation and is subject to change.]

Represents a transaction.
Inheritance Hierarchy

SystemObject
  CalculationWorks.BusinessModelBcfTransaction

Namespace: CalculationWorks.BusinessModel
Assembly: CalculationWorks.BusinessModel (in CalculationWorks.BusinessModel.dll) Version: 1.1.0.0
Syntax

public class BcfTransaction : IBcfUndoRedoItem

The BcfTransaction type exposes the following members.

Constructors

  NameDescription
Protected methodBcfTransaction

Transaction infrastructure. Do not call this method.

To begin a transaction use BcfDataSet.BeginTransaction. To begin a sub transaction use the current transactions BeginSubTransaction method.

Initializes a new instance of the BcfTransaction class.

Top
Methods

  NameDescription
Protected methodAddItem
Adds the IBcfUndoRedoItem to the transactions compensation repository.
Public methodBeginSubTransaction
Begins a sub transaction.
Public methodBeginSubTransaction(BcfTransactionBuilder)
Begins a sub transaction.
Public methodCommit
Commits all changes within this transaction.
Public methodCompute
Executes all necessary operations to bring the BcfCell.Values up to date. The validation tags will not be updated.
Public methodCompute(Boolean)
Executes all necessary operations to bring the BcfCell.Values up to date.
Public methodEnforceRelationConstraints
Updates the internal indexes and throws ArgumentException if any foreign or unique key constraint is violated.
Public methodEnterDumbMode

Sets all computed cells and validations to 'must recompute' and disables the internal change tracking until next call of Compute (implicit by BeginSubTransaction or Commit) or Rollback. When DumbMode ends all computed cells and validations will be recomputed.

Very useful when loading data into an empty BcfDataSet.

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 a hash function for a particular type.
(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.)
Protected methodRedo
Infrastructure. This method supports the infrastructure and is not intended to be used directly from your code.
Public methodRollback
Discards the transaction and restores the data from state before the transaction started.
Public methodRollback(Exception)
Discards the transaction and restores the data from state before the transaction started.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Protected methodUndo
Infrastructure. This method supports the infrastructure and is not intended to be used directly from your code.
Top
Properties

  NameDescription
Protected propertyCompensationRepository
Gets the compensation repository.
Public propertyDataSet
Gets the BcfDataSet the transaction belongs to.
Public propertyIsCommitted
Gets a value indicating whether this instance is committed.
Public propertyIsCurrent
Gets a value indicating whether this instance is current.
Public propertyIsDiscarded
Gets a value indicating whether this instance is discarded.
Public propertyIsSubTransaction
Gets a value indicating whether this instance is sub transaction.
Top
Remarks

Any update operation on a data object is wrapped in a transaction. Setting a value or adding a row will create a transaction, execute the operation and commit the transaction. Before every begin and end of any transaction or subtransaction the outstanding calculations and validations will be processed. To improve performance and get a nice undo repository when more than one cell update is required, it is recommended to use transactions explicit. Begin a try-block immediately after the transaction is created. The transaction commit should always be the last instruction inside the try-block. Rollback failed transactions.

Examples

BcfTransaction transaction = myBcfDataSet.CreateTransaction();
try {
   ... do some data updates ...
   transaction.Commit();
}
catch(BcfComputeException ex) {
   transaction.Rollback(ex);
   throw;
}

See Also

Reference