Click or drag to resize

BcfDataSetRestoreUndoRepository Method

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

Restores a file-based undo repository and initial dataset state (data when called EnableFileUndoSession(Stream, Stream, Byte)), enables undo and returns the last known transaction index.

Namespace:  CalculationWorks.BusinessModel
Assembly:  CalculationWorks.BusinessModel (in CalculationWorks.BusinessModel.dll) Version: 4.0.0-beta7
Syntax
public int RestoreUndoRepository(
	Stream indexFile,
	Stream dataFile
)

Parameters

indexFile
Type: System.IOStream
A navigable (file-) Stream.
dataFile
Type: System.IOStream
A navigable (file-) Stream.

Return Value

Type: Int32
An Int32 representing the number of transactions to be redone to restore last saved state.
Exceptions
ExceptionCondition
ArgumentNullExceptionindexFile or dataFile is null.
ArgumentExceptionindexFile or dataFile are not navigable.
ObjectDisposedExceptionThis BcfDataSet is disposed.
InvalidOperationException

BcfDataSet is Locked.

or

UndoSerializationService is null

or

CurrentTransaction is not null

or

Undo is already enabled.

BcfCalculationExceptionWraps calculation exceptions if allowed by HandleCalculationException.
Remarks

The method restores the repository and returns the last saved undo position. Use the return value to restore the last saved state e.g.

var redoCount = RestoreUndoRepository(IndexFile, DataFile);
Redo(redoCount);

An undo repository created with EnableFileUndoSession(Stream, Stream, Byte) can be restored if:

  • The same BcfDataSet class with the same version has written the files.
  • The files are not corrupt.
  • The files not locked.

The method clears data and current undo repository. When restoring failed due to an exception the previous state will not be restored.

See Also