Click or drag to resize
CalculationWorks Logo
Using Undo Redo

How Undo and Redo works

BCF encapsulates data updates in transactions. BcfTransaction has already a capability to rollback and repeat data updates. To support undo and redo the processed transactions will be stored in a repository. The repository has two stacks. Processed transactions for undo and 'Undone' transactions for redo. When a transaction was committed it will be pushed on the undo-stack and the redo-stack will be cleared. When undoing last transaction from undo-stack will be rolled back and the transaction will be moved to redo-stack.

Using Undo-Redo Feature

  1. Choose a repository

    An undo-repository is always a BcfDataSetBehaviorItem. Add a repositiory to your model by adding it as DataSetBehavior using BCF Editor - or - modify your BcfDataSetSetup before it is used in BcfDataSet constructor:

    var dss = new MyTestDataSetSetup();
    
    // add undo-repository
    dss.BehaviorItems.Add(new BcfDataSetUndoRepository());
    
    var ds = new MyTestDataSet(dss);
  2. Enable at runtime

    After creating a BcfDataSet undo is disabled by default. To enable call EnableChangeTracking.

    ds.EnableChangeTracking();

Most important undo redo related members