BriefcaseDb Class
A local copy of an iModel from iModelHub that can pull and potentially push changesets. BriefcaseDb raises a set of events to allow apps and subsystems to track its object life cycle, including onOpen and onOpened.
Extends
Extended by
Methods
| Name | Description | |
|---|---|---|
| constructor(args: { briefcaseId: number, key: string, nativeDb: IModelJsNative.DgnDb, openMode: OpenMode }): BriefcaseDb Protected | ||
| close(): void | Close this IModel, if it is currently open, and save changes if it was opened in ReadWrite mode. | |
| disableChangesetStatTracking(): Promise<void> | ||
| enableChangesetStatTracking(): Promise<void> | ||
| getAllChangesetHealthData(): Promise<ChangesetHealthStats[]> | ||
| makeLockControl(): void Protected | ||
| pullChanges(arg?: PullChangesArgs): Promise<void> | Pull and apply changesets from iModelHub | |
| pushChanges(arg: PushChangesArgs): Promise<void> | Push changes to iModelHub. | |
| revertAndPushChanges(arg: RevertChangesArgs): Promise<void> | Revert timeline changes and then push resulting changeset | |
| findByKey(key: string): BriefcaseDb Static | Find an open IModelDb by its key. | |
| open(args: OpenBriefcaseArgs): Promise<BriefcaseDb> Static | Open a briefcase file and return a new BriefcaseDb to interact with it. | |
| tryFindByKey(key: string): undefined | BriefcaseDb Static | Attempt to find an open IModelDb by key. | |
| upgradeSchemas(briefcase: OpenBriefcaseArgs): Promise<void> Static | Upgrades the schemas in the iModel based on the current version of the software. |
Inherited methods
| Name | Inherited from | Description |
|---|---|---|
| abandonChanges(): void Inherited | IModelDb | Abandon changes in memory that have not been saved as a Txn to this iModelDb. |
| acquireSchemaLock(): Promise<void> Inherited | IModelDb | Acquire the exclusive schema lock on this iModel. |
| attachDb(fileName: string, alias: string): void Inherited | IModelDb | Attach an iModel file to this connection and load and register its schemas. |
| clearCaches(): void Inherited | IModelDb | Clear all in-memory caches held in this IModelDb. |
| computeProjectExtents(options?: ComputeProjectExtentsOptions): ComputedProjectExtents Inherited | IModelDb | Compute an appropriate project extents for this iModel based on the ranges of all spatial elements. |
| constructEntity<T extends Entity, P extends EntityProps>(props: P): T Inherited | IModelDb | Construct an entity (Element or Model) from an iModel. |
| containsClass(classFullName: string): boolean Inherited | IModelDb | Query if this iModel contains the definition of the specified class. |
| createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader Inherited | IModelDb | Allow to execute query and read results along with meta data. |
| deleteFileProperty(prop: FilePropertyProps): void Inherited | IModelDb | delete a "file property" from this iModel |
| deleteSettingDictionary(name: string): void Inherited | IModelDb | Delete a SettingDictionary, previously added with saveSettingDictionary, from this iModel. |
| detachDb(alias: string): void Inherited | IModelDb | Detach the attached file from this connection. |
| elementGeometryCacheOperation(requestProps: ElementGeometryCacheOperationRequestProps): BentleyStatus Inherited | IModelDb | Request operation using the backend geometry cache populated by first calling elementGeometryRequest. |
| elementGeometryRequest(requestProps: ElementGeometryRequest): IModelStatus Inherited | IModelDb | Request geometry stream information from an element in binary format instead of json. |
| exportGraphics(exportProps: ExportGraphicsOptions): DbResult Inherited | IModelDb | Export meshes suitable for graphics APIs from arbitrary geometry in elements in this IModelDb. |
| exportPartGraphics(exportProps: ExportPartGraphicsOptions): DbResult Inherited | IModelDb | Exports meshes suitable for graphics APIs from a specified GeometryPart |
| exportSchema(args: ExportSchemaArgs): void Inherited | IModelDb | Writes the contents of a single ECSchema to a file on the local file system. |
| exportSchemas(outputDirectory: string): void Inherited | IModelDb | Writes the contents of all ECSchemas in this iModel to files in a directory on the local file system. |
| forEachMetaData(classFullName: string, wantSuper: boolean, func: PropertyCallback, includeCustom: boolean = true): void Inherited | IModelDb | Invoke a callback on each property of the specified class, optionally including superclass properties. |
| generateElementGraphics(request: ElementGraphicsRequestProps): Promise<undefined | Uint8Array> Inherited | IModelDb | Generate graphics for an element or geometry stream. |
| getBriefcaseId(): number Inherited | IModelDb | Get the briefcase Id of this iModel |
| getGeoCoordinatesFromIModelCoordinates(props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> Inherited | IModelDb | Get the GeoCoordinate (longitude, latitude, elevation) corresponding to each IModel Coordinate point in the input |
| getGeometryContainment(props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> Inherited | IModelDb | Get the clip containment status for the supplied elements. |
| getIModelCoordinatesFromGeoCoordinates(props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> Inherited | IModelDb | Get the IModel coordinate corresponding to each GeoCoordinate point in the input |
| getJsClass<T extends Entity>(classFullName: string): T Inherited | IModelDb | Get the JavaScript class that handles a given entity class. |
| getLastError(): string Inherited | IModelDb | Returns a string representation of the error that most recently arose during an operation on the underlying SQLite database. |
| getMassProperties(props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> Inherited | IModelDb | Get the mass properties for the supplied elements. |
| getMetaData(classFullName: string): EntityMetaData Inherited | IModelDb | Get metadata for a class. |
| getSchemaProps(name: string): ECSchemaProps Inherited | IModelDb | Returns the full schema for the input name. |
| importSchemas(schemaFileNames: string[], options?: SchemaImportOptions): Promise<void> Inherited | IModelDb | Import an ECSchema. |
| inlineGeometryParts(): InlineGeometryPartsResult Inherited | IModelDb | Attempts to optimize all of the geometry in this iModel by identifying GeometryParts that are referenced by exactly one |
| isBriefcaseDb(): this is BriefcaseDb Inherited | IModelDb | Type guard for instanceof BriefcaseDb |
| isSnapshotDb(): this is SnapshotDb Inherited | IModelDb | Type guard for instanceof SnapshotDb |
| isStandaloneDb(): this is StandaloneDb Inherited | IModelDb | Type guard for instanceof StandaloneDb. |
| performCheckpoint(): void Inherited | IModelDb | Save all changes and perform a checkpoint on this IModelDb. |
| prepareStatement(sql: string, logErrors: boolean = true): ECSqlStatement Inherited | IModelDb | Prepare an ECSQL statement. |
| queryEntityIds(params: EntityQueryParams): Id64Set Inherited | IModelDb | Query for a set of entity ids, given an EntityQueryParams |
| queryFilePropertyBlob(prop: FilePropertyProps): undefined | Uint8Array Inherited | IModelDb | Query a "file property" from this iModel, as a blob. |
| queryFilePropertyString(prop: FilePropertyProps): undefined | string Inherited | IModelDb | Query a "file property" from this iModel, as a string. |
| queryNextAvailableFileProperty(prop: FilePropertyProps): number Inherited | IModelDb | Query for the next available major id for a "file property" from this iModel. |
| querySchemaVersion(schemaName: string): undefined | string Inherited | IModelDb | Query the version of a schema of the specified name in this iModel. |
| querySchemaVersionNumbers(schemaName: string): undefined | ECVersion Inherited | IModelDb | Query the version of a schema of the specified name in this iModel. |
| saveChanges(description?: string): void Inherited | IModelDb | Commit unsaved changes in memory as a Txn to this iModelDb. |
| saveChanges(args: ): void Inherited | IModelDb | Commit unsaved changes in memory as a Txn to this iModelDb. |
| saveFileProperty(prop: FilePropertyProps, strValue: string, blobVal?: Uint8Array): void Inherited | IModelDb | Save a "file property" to this iModel |
| saveSettingDictionary(name: string, dict: SettingsContainer): void Inherited | IModelDb | Save a SettingDictionary in this iModel that will be loaded into settings every time this iModel is opened in future sessions. |
| simplifyElementGeometry(args: SimplifyElementGeometryArgs): IModelStatus Inherited | IModelDb | Attempt to simplify the geometry stream of a single GeometricElement or GeometryPart as specified by args. |
| tryGetMetaData(classFullName: string): undefined | EntityMetaData Inherited | IModelDb | Identical to getMetaData, except it returns undefined instead of throwing an error if the metadata cannot be found nor loaded. |
| tryPrepareStatement(sql: string): undefined | ECSqlStatement Inherited | IModelDb | Prepare an ECSQL statement. |
| updateEcefLocation(ecef: EcefLocation): void Inherited | IModelDb | Update the EcefLocation of this iModel. |
| updateElementGeometryCache(requestProps: ElementGeometryCacheRequestProps): Promise<ElementGeometryCacheResponseProps> Inherited | IModelDb | Request the creation of a backend geometry cache for the specified geometric element. |
| updateIModelProps(): void Inherited | IModelDb | Update the IModelProps of this iModel in the database. |
| updateProjectExtents(newExtents: Range3d): void Inherited | IModelDb | Update the project extents for this iModel. |
| withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors: boolean = true): T Inherited | IModelDb | Use a prepared SQL statement, potentially from the statement cache. |
| withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors: boolean = true): T Inherited | IModelDb | Use a prepared ECSQL statement, potentially from the statement cache. |
| withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors: boolean = true): T Inherited | IModelDb | Prepared and execute a callback on a SQL statement. |
| withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors: boolean = true): T Inherited | IModelDb | Prepared and execute a callback on an ECSQL statement. |
| findByFilename(fileName: string): undefined | IModelDb Static Inherited | IModelDb | Find an opened instance of any subclass of IModelDb, by filename |
| forEachMetaData(iModel: IModelDb, classFullName: string, wantSuper: boolean, func: PropertyCallback, includeCustom: boolean = true): void Static Inherited | IModelDb | Invoke a callback on each property of the specified class, optionally including superclass properties. |
| validateSchemas(filePath: string, forReadWrite: boolean): SchemaState Static Inherited | IModelDb | Determines if the schemas in the Db must or can be upgraded by comparing them with those included in the |
Properties
| Name | Type | Description | |
|---|---|---|---|
| briefcaseId Readonly | number | ||
| isBriefcase Accessor ReadOnly | boolean | override superclass method | |
| iTwinId Accessor ReadOnly | string | The Guid that identifies the context that owns this iModel. | |
| onClosed Readonly | BeEvent<() => void> | Event raised after a BriefcaseDb has been closed. | |
| onOpen Static Readonly | BeEvent<(_args: OpenBriefcaseArgs) => void> | Event raised just before a BriefcaseDb is opened. | |
| onOpened Static Readonly | BeEvent<(_iModelDb: BriefcaseDb, _args: OpenBriefcaseArgs) => void> | Event raised just after a BriefcaseDb is opened. | |
| txns Readonly | TxnManager | Manages local changes to this briefcase. | |
| useLockServer Accessor Protected ReadOnly | boolean | Determine whether this BriefcaseDb should use a lock server. |
Inherited properties
| Name | Type | Inherited from | Description |
|---|---|---|---|
| _fontMap Protected Inherited | FontMap | undefined | IModelDb | |
| channels Readonly Inherited | ChannelControl | IModelDb | |
| cloudContainer Accessor Inherited ReadOnly | undefined | CloudSqlite.CloudContainer | IModelDb | get the cloud container for this iModel, if it was opened from one |
| codeSpecs Accessor Inherited ReadOnly | CodeSpecs | IModelDb | Get the CodeSpecs in this IModel. |
| codeValueBehavior Accessor Inherited | "exact" | "trim-unicode-whitespace" | IModelDb | Controls how Codes are copied from this iModel into another iModel, to work around problems with iModels created by older connectors. The imodel-transformer sets this appropriately on your behalf - you should never need to set or interrogate this property yourself. |
| defaultLimit Static Readonly Inherited | "1000" | IModelDb | |
| elements Readonly Inherited | IModelDb.Elements | IModelDb | |
| fontMap Accessor Inherited ReadOnly | FontMap | IModelDb | |
| fonts Accessor Inherited ReadOnly | IModelDbFonts | IModelDb | Provides methods for interacting with font-related information stored in this iModel. |
| holdsSchemaLock Accessor Inherited ReadOnly | boolean | IModelDb | determine whether the schema lock is currently held for this iModel. |
| iModelId Accessor Inherited ReadOnly | string | IModelDb | The Guid that identifies this iModel. |
| isReadonly Accessor Inherited ReadOnly | boolean | IModelDb | Check if this iModel has been opened read-only or not. |
| isSnapshot Accessor Inherited ReadOnly | boolean | IModelDb | Returns true if this is a SnapshotDb |
| jsClassMap Accessor Inherited ReadOnly | EntityJsClassMap | IModelDb | Allows registering js classes mapped to ECClasses |
| locks Accessor Inherited ReadOnly | LockControl | IModelDb | The LockControl that orchestrates concurrent editing of this iModel. |
| maxLimit Static Readonly Inherited | "10000" | IModelDb | |
| models Readonly Inherited | IModelDb.Models | IModelDb | |
| onBeforeClose Readonly Inherited | BeEvent<() => void> | IModelDb | Event called when the iModel is about to be closed. |
| onChangesetApplied Readonly Inherited | BeEvent<() => void> | IModelDb | Event called after a changeset is applied to this IModelDb. |
| pathName Accessor Inherited ReadOnly | string | IModelDb | Get the full path fileName of this iModelDb |
| relationships Accessor Inherited ReadOnly | Relationships | IModelDb | Get the linkTableRelationships for this IModel |
| schemaContext Accessor Inherited ReadOnly | SchemaContext | IModelDb | Gets the context that allows accessing the metadata (ecschema-metadata package) of this iModel |
| schemaMap Accessor Inherited ReadOnly | SchemaMap | IModelDb | Allows locally registering a schema for this imodel, in constrast to [Schemas.registerSchema] which is a global operation |
| tiles Readonly Inherited | IModelDb.Tiles | IModelDb | |
| views Readonly Inherited | IModelDb.Views | IModelDb | |
| workspace Accessor Inherited ReadOnly | Workspace | IModelDb | Get the Workspace for this iModel. |
Defined in
- core/backend/src/IModelDb.ts Line 3029
Last Updated: 24 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.