EditTxn Class @beta
Represents an explicit editing transaction for an iModel.
An explicit EditTxn lets callers define a deliberate unit of work by choosing when editing
starts (start) and how it ends (end() / end("save") or end("abandon")). This avoids mixing
unrelated edits into one implicit unit of work and makes save/rollback boundaries explicit.
Explicit EditTxn instances must be active before mutating operations are performed, regardless of enforcement level.
In other words, explicit transaction behavior is independent of implicitWriteEnforcement.
@see EditTxn transaction model and migration guidance
During indirect changes (commit processing): Use callback args (indirectEditTxn) in callbacks like
onRootChangedArg and onDeletedDependencyArg that fire during indirect processing.
Methods
| Name | Description | |
|---|---|---|
| constructor(iModel: IModelDb, description: string): EditTxn | ||
| abandonChanges(): void | Abandon database changes while keeping this EditTxn active. | |
| deleteAspect(aspectInstanceIds: Id64Arg): void | Delete one or more aspects from the iModel. | |
| deleteDefinitionElements(definitionElementIds: Id64Array): Id64Set | Delete definition elements from the iModel when they are not referenced. | |
| deleteElement(ids: Id64Arg): void | Delete elements from the iModel. | |
| deleteElements(ids: Id64Array, deleteOptions?: BulkDeleteElementsArgs): BulkDeleteElementsResult | Delete multiple elements from the iModel. | |
| deleteFileProperty(prop: FilePropertyProps): void | Delete a file property from the iModel. | |
| deleteModel(ids: Id64Arg): void | Delete models from the iModel. | |
| deleteRelationship(props: RelationshipProps): void | Delete a relationship from the iModel. | |
| deleteRelationships(props: ReadonlyArray<RelationshipProps>): void | Delete multiple relationships from the iModel. | |
| deleteSettingDictionary(name: string): void | Delete a SettingDictionary from this iModel. | |
| end(mode: "save" | "abandon", args?: string | SaveChangesArgs): void | ||
| end(): void | End this EditTxn, either by saving or abandoning the changes. | |
| insertAspect(aspectProps: ElementAspectProps): string | Insert a new aspect into the iModel. | |
| insertElement(elProps: ElementProps, options?: InsertElementOptions): string | Insert a new element into the iModel. | |
| insertModel(props: ModelProps): string | Insert a new model into the iModel. | |
| insertRelationship(props: RelationshipProps): string | Insert a new relationship into the iModel. | |
| onClose(): void | Invoked when the owning iModel is closing. | |
| saveChanges(args?: string | SaveChangesArgs): void | Save changes with additional arguments. | |
| saveDefaultViewStore(arg: CloudSqlite.ContainerProps): void | Save a default ViewStore container reference in this iModel. | |
| saveFileProperty(prop: FilePropertyProps, strValue: string, blobVal?: Uint8Array): void | Save a file property to the iModel. | |
| saveSettingDictionary(name: string, dict: SettingsContainer): void | Save a SettingDictionary in this iModel. |
|
| start(): void | Start this EditTxn, making it the active transaction for the iModel. | |
| updateAspect(aspectProps: ElementAspectProps): void | Update an existing aspect in the iModel. | |
| updateEcefLocation(ecef: EcefLocationProps): void | Update the ECEF location of the iModel. | |
| updateElement<T extends ElementProps>(elProps: Partial<T>): void | Update an existing element in the iModel. | |
| updateGeometryGuid(modelId: string): void | Update the geometry guid of a model. | |
| updateIModelProps(): void | Update the iModel props in the database from the current in-memory state. | |
| updateModel(props: UpdateModelOptions): void | Update an existing model in the iModel. | |
| updateProjectExtents(newExtents: Range3dProps): void | Update the project extents of the iModel. | |
| updateRelationship(props: RelationshipProps): void | Update an existing relationship in the iModel. | |
| verifyWriteable(): void |
Properties
| Name | Type | Description | |
|---|---|---|---|
| description | string | Default description passed to saveChanges when saving this transaction. | |
| iModel Readonly | IModelDb | The iModel this EditTxn may modify. | |
| implicitWriteEnforcement Static | ImplicitWriteEnforcement | Controls how writes through the implicit transaction are handled. | |
| isActive Accessor ReadOnly | boolean | True if this transaction currently owns the iModel write surface. |
Defined in
- backend/src/EditTxn.ts Line 84
Last Updated: 28 April, 2026