TxnManager Class

Manages local changes to a BriefcaseDb or StandaloneDb via Txns

Methods

Name Description
beginMultiTxnOperation(): DbResult Begin a new multi-Txn operation.  
cancelTo(txnId: string): IModelStatus Reverse and then cancel (make non-reinstatable) all changes back to a previous TxnId.  
endMultiTxnOperation(): DbResult End a multi-Txn operation  
getCurrentTxnId(): string Get the Id of the current (tip) transaction.  
getMultiTxnOperationDepth(): number Return the depth of the multi-Txn stack.  
getRedoString(): string Get a description of the operation that would be reinstated by calling reinstateTxn.  
getTxnDescription(txnId: string): string Get the description that was supplied when the specified transaction was saved.  
getUndoString(): string Get the description of the operation that would be reversed by calling reverseTxns(1).  
isTxnIdValid(txnId: string): boolean Test if a TxnId is valid  
queryFirstTxnId(): string Get the Id of the first transaction, if any.  
queryLocalChanges(args?: QueryLocalChangesArgs): Iterable<ChangeInstanceKey, any, any> Obtain a list of the EC instances that have been changed locally by the BriefcaseDb associated with this TxnManager and have not yet been pushed to the iModel.  
queryNextTxnId(txnId: string): string Get the successor of the specified TxnId  
queryPreviousTxnId(txnId: string): string Get the predecessor of the specified TxnId  
reinstateTxn(): IModelStatus Reinstate the most recently reversed transaction.  
reportError(error: ValidationError): void Dependency handlers may call method this to report a validation error.  
restartSession(): void Restart the current TxnManager session.  
reverseAll(): IModelStatus Reverse all changes back to the beginning of the session.  
reverseSingleTxn(): IModelStatus Reverse the most recent operation.  
reverseTo(txnId: string): IModelStatus Reverse all changes back to a previously saved TxnId.  
reverseTxns(numOperations: number): IModelStatus Reverse (undo) the most recent operation(s) to this IModelDb.  

Properties

Name Type Description
hasFatalError Accessor ReadOnly boolean Determine whether any fatal validation errors have occurred during dependency propagation.  
hasLocalChanges Accessor ReadOnly boolean Query if there are un-saved or un-pushed local changes.  
hasPendingTxns Accessor ReadOnly boolean Query if there are any pending Txns in this IModelDb that are waiting to be pushed.  
hasUnsavedChanges Accessor ReadOnly boolean Query if there are any changes in memory that have yet to be saved to the IModelDb.  
isIndirectChanges Accessor ReadOnly boolean Determine whether current txn is propagating indirect changes or not.  
isRedoPossible Accessor ReadOnly boolean Determine if there are currently any reinstatable (redoable) changes  
isUndoPossible Accessor ReadOnly boolean Determine if there are currently any reversible (undoable) changes from this editing session.  
onAfterUndoRedo Readonly BeEvent<(isUndo: boolean) => void> Event raised after an undo/redo operation has been performed.  
onBeforeUndoRedo Readonly BeEvent<(isUndo: boolean) => void> Event raised before an undo/redo operation is performed.  
onChangesApplied Readonly BeEvent<() => void> Event raised after a ChangeSet has been applied to this briefcase  
onCommit Readonly BeEvent<() => void> Event raised before a commit operation is performed.  
onCommitted Readonly BeEvent<() => void> Event raised after a commit operation has been performed.  
onElementsChanged Readonly BeEvent<(changes: TxnChangedEntities) => void> Called after validation completes from saveChanges.  
onGeometryChanged Readonly BeEvent<(models: ModelGeometryChangesProps[]) => void>    
onModelGeometryChanged Readonly BeEvent<(changes: ReadonlyArray<ModelIdAndGeometryGuid>) => void> Event raised after the geometry within one or more GeometricModels is modified by applying a changeset or validation of a transaction.  
onModelsChanged Readonly BeEvent<(changes: TxnChangedEntities) => void> Called after validation completes from saveChanges.  
onReplayedExternalTxns Readonly BeEvent<() => void> Event raised for a read-only briefcase that was opened with the watchForChanges flag enabled when changes made by another connection are applied to the briefcase.  
onReplayExternalTxns Readonly BeEvent<() => void> Event raised for a read-only briefcase that was opened with the watchForChanges flag enabled when changes made by another connection are applied to the briefcase.  
validationErrors Readonly ValidationError[] Array of errors from dependency propagation  

Defined in

Last Updated: 13 November, 2024