StandaloneDb Class
Standalone iModels are read/write files that are not associated with an iTwin or managed by iModelHub. They are relevant only for testing, or for small-scale single-user scenarios. Standalone iModels are designed such that the API for Standalone iModels and Briefcase iModels (those synchronized with iModelHub) are as similar and consistent as possible. This leads to a straightforward process where the a user starts with StandaloneDb and can optionally choose to upgrade to an iTwin.
Some additional details. Standalone iModels:
- always have Guid.empty for their iTwinId (they are "unassociated" files)
- always have BriefcaseId === BriefcaseIdValue.Unassigned
- are connected to the frontend via BriefcaseConnection.openStandalone
- may be opened without supplying any user credentials
- may be opened read/write
- cannot apply a changeset to nor generate a changesets (since there is no timeline from which to get/push changesets)
Extends
Extended by
Methods
| Name | Description | |
|---|---|---|
| constructor(args: { briefcaseId: number, key: string, nativeDb: IModelJsNative.DgnDb, openMode: OpenMode }): StandaloneDb Protected | ||
| createClassViews(): void | Creates or updates views in the iModel to permit visualizing the EC content as ECClasses and ECProperties rather than raw database tables and columns. | |
| convertToStandalone(iModelFileName: string): void Static | Convert an iModel stored on the local file system into a StandaloneDb, chiefly for testing purposes. | |
| createEmpty(filePath: string, args: CreateEmptyStandaloneIModelProps): StandaloneDb Static | Create an empty standalone iModel. | |
| findByKey(key: string): StandaloneDb Static | Find an open IModelDb by its key. | |
| openFile(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, options?: SnapshotDbOpenArgs): StandaloneDb Static | Open a standalone iModel file. | |
| tryFindByKey(key: string): undefined | StandaloneDb Static | Attempt to find an open IModelDb by key. | |
| upgradeStandaloneSchemas(filePath: string): void Static | Upgrades the schemas in the standalone iModel file. |
Inherited methods
| Name | Inherited from | Description |
|---|---|---|
| abandonChanges(): void Inherited | BriefcaseDb | Abandon changes in memory that have not been saved as a Txn to this iModelDb. |
| acquireSchemaLock(): Promise<void> Inherited | BriefcaseDb | Acquire the exclusive schema lock on this iModel. |
| attachDb(fileName: string, alias: string): void Inherited | BriefcaseDb | Attach an iModel file to this connection and load and register its schemas. |
| clearCaches(): void Inherited | BriefcaseDb | Clear all in-memory caches held in this IModelDb. |
| close(): void Inherited | BriefcaseDb | Close this IModel, if it is currently open, and save changes if it was opened in ReadWrite mode. |
| computeProjectExtents(options?: ComputeProjectExtentsOptions): ComputedProjectExtents Inherited | BriefcaseDb | 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 | BriefcaseDb | Construct an entity (Element or Model) from an iModel. |
| containsClass(classFullName: string): boolean Inherited | BriefcaseDb | Query if this iModel contains the definition of the specified class. |
| createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader Inherited | BriefcaseDb | Allow to execute query and read results along with meta data. |
| deleteFileProperty(prop: FilePropertyProps): void Inherited | BriefcaseDb | delete a "file property" from this iModel |
| deleteSettingDictionary(name: string): void Inherited | BriefcaseDb | Delete a SettingDictionary, previously added with saveSettingDictionary, from this iModel. |
| detachDb(alias: string): void Inherited | BriefcaseDb | Detach the attached file from this connection. |
| disableChangesetStatTracking(): Promise<void> Inherited | BriefcaseDb | |
| elementGeometryCacheOperation(requestProps: ElementGeometryCacheOperationRequestProps): BentleyStatus Inherited | BriefcaseDb | Request operation using the backend geometry cache populated by first calling elementGeometryRequest. |
| elementGeometryRequest(requestProps: ElementGeometryRequest): IModelStatus Inherited | BriefcaseDb | Request geometry stream information from an element in binary format instead of json. |
| enableChangesetStatTracking(): Promise<void> Inherited | BriefcaseDb | |
| exportGraphics(exportProps: ExportGraphicsOptions): DbResult Inherited | BriefcaseDb | Export meshes suitable for graphics APIs from arbitrary geometry in elements in this IModelDb. |
| exportPartGraphics(exportProps: ExportPartGraphicsOptions): DbResult Inherited | BriefcaseDb | Exports meshes suitable for graphics APIs from a specified GeometryPart |
| exportSchema(args: ExportSchemaArgs): void Inherited | BriefcaseDb | Writes the contents of a single ECSchema to a file on the local file system. |
| exportSchemas(outputDirectory: string): void Inherited | BriefcaseDb | 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 | BriefcaseDb | Invoke a callback on each property of the specified class, optionally including superclass properties. |
| generateElementGraphics(request: ElementGraphicsRequestProps): Promise<undefined | Uint8Array> Inherited | BriefcaseDb | Generate graphics for an element or geometry stream. |
| getAllChangesetHealthData(): Promise<ChangesetHealthStats[]> Inherited | BriefcaseDb | |
| getBriefcaseId(): number Inherited | BriefcaseDb | Get the briefcase Id of this iModel |
| getGeoCoordinatesFromIModelCoordinates(props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> Inherited | BriefcaseDb | Get the GeoCoordinate (longitude, latitude, elevation) corresponding to each IModel Coordinate point in the input |
| getGeometryContainment(props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> Inherited | BriefcaseDb | Get the clip containment status for the supplied elements. |
| getIModelCoordinatesFromGeoCoordinates(props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> Inherited | BriefcaseDb | Get the IModel coordinate corresponding to each GeoCoordinate point in the input |
| getJsClass<T extends Entity>(classFullName: string): T Inherited | BriefcaseDb | Get the JavaScript class that handles a given entity class. |
| getLastError(): string Inherited | BriefcaseDb | 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 | BriefcaseDb | Get the mass properties for the supplied elements. |
| getMetaData(classFullName: string): EntityMetaData Inherited | BriefcaseDb | Get metadata for a class. |
| getSchemaProps(name: string): ECSchemaProps Inherited | BriefcaseDb | Returns the full schema for the input name. |
| importSchemas(schemaFileNames: string[], options?: SchemaImportOptions): Promise<void> Inherited | BriefcaseDb | Import an ECSchema. |
| inlineGeometryParts(): InlineGeometryPartsResult Inherited | BriefcaseDb | Attempts to optimize all of the geometry in this iModel by identifying GeometryParts that are referenced by exactly one |
| isBriefcaseDb(): this is BriefcaseDb Inherited | BriefcaseDb | Type guard for instanceof BriefcaseDb |
| isSnapshotDb(): this is SnapshotDb Inherited | BriefcaseDb | Type guard for instanceof SnapshotDb |
| isStandaloneDb(): this is StandaloneDb Inherited | BriefcaseDb | Type guard for instanceof StandaloneDb. |
| makeLockControl(): void Protected Inherited | BriefcaseDb | |
| performCheckpoint(): void Inherited | BriefcaseDb | Save all changes and perform a checkpoint on this IModelDb. |
| prepareStatement(sql: string, logErrors: boolean = true): ECSqlStatement Inherited | BriefcaseDb | Prepare an ECSQL statement. |
| pullChanges(arg?: PullChangesArgs): Promise<void> Inherited | BriefcaseDb | Pull and apply changesets from iModelHub |
| pushChanges(arg: PushChangesArgs): Promise<void> Inherited | BriefcaseDb | Push changes to iModelHub. |
| queryEntityIds(params: EntityQueryParams): Id64Set Inherited | BriefcaseDb | Query for a set of entity ids, given an EntityQueryParams |
| queryFilePropertyBlob(prop: FilePropertyProps): undefined | Uint8Array Inherited | BriefcaseDb | Query a "file property" from this iModel, as a blob. |
| queryFilePropertyString(prop: FilePropertyProps): undefined | string Inherited | BriefcaseDb | Query a "file property" from this iModel, as a string. |
| queryNextAvailableFileProperty(prop: FilePropertyProps): number Inherited | BriefcaseDb | Query for the next available major id for a "file property" from this iModel. |
| querySchemaVersion(schemaName: string): undefined | string Inherited | BriefcaseDb | Query the version of a schema of the specified name in this iModel. |
| querySchemaVersionNumbers(schemaName: string): undefined | ECVersion Inherited | BriefcaseDb | Query the version of a schema of the specified name in this iModel. |
| revertAndPushChanges(arg: RevertChangesArgs): Promise<void> Inherited | BriefcaseDb | Revert timeline changes and then push resulting changeset |
| saveChanges(description?: string): void Inherited | BriefcaseDb | Commit unsaved changes in memory as a Txn to this iModelDb. |
| saveChanges(args: ): void Inherited | BriefcaseDb | Commit unsaved changes in memory as a Txn to this iModelDb. |
| saveFileProperty(prop: FilePropertyProps, strValue: string, blobVal?: Uint8Array): void Inherited | BriefcaseDb | Save a "file property" to this iModel |
| saveSettingDictionary(name: string, dict: SettingsContainer): void Inherited | BriefcaseDb | 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 | BriefcaseDb | Attempt to simplify the geometry stream of a single GeometricElement or GeometryPart as specified by args. |
| tryGetMetaData(classFullName: string): undefined | EntityMetaData Inherited | BriefcaseDb | 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 | BriefcaseDb | Prepare an ECSQL statement. |
| updateEcefLocation(ecef: EcefLocation): void Inherited | BriefcaseDb | Update the EcefLocation of this iModel. |
| updateElementGeometryCache(requestProps: ElementGeometryCacheRequestProps): Promise<ElementGeometryCacheResponseProps> Inherited | BriefcaseDb | Request the creation of a backend geometry cache for the specified geometric element. |
| updateIModelProps(): void Inherited | BriefcaseDb | Update the IModelProps of this iModel in the database. |
| updateProjectExtents(newExtents: Range3d): void Inherited | BriefcaseDb | Update the project extents for this iModel. |
| withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors: boolean = true): T Inherited | BriefcaseDb | Use a prepared SQL statement, potentially from the statement cache. |
| withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors: boolean = true): T Inherited | BriefcaseDb | Use a prepared ECSQL statement, potentially from the statement cache. |
| withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors: boolean = true): T Inherited | BriefcaseDb | Prepared and execute a callback on a SQL statement. |
| withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors: boolean = true): T Inherited | BriefcaseDb | Prepared and execute a callback on an ECSQL statement. |
| findByFilename(fileName: string): undefined | IModelDb Static Inherited | BriefcaseDb | 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 | BriefcaseDb | Invoke a callback on each property of the specified class, optionally including superclass properties. |
| open(args: OpenBriefcaseArgs): Promise<BriefcaseDb> Static Inherited | BriefcaseDb | Open a briefcase file and return a new BriefcaseDb to interact with it. |
| upgradeSchemas(briefcase: OpenBriefcaseArgs): Promise<void> Static Inherited | BriefcaseDb | Upgrades the schemas in the iModel based on the current version of the software. |
| validateSchemas(filePath: string, forReadWrite: boolean): SchemaState Static Inherited | BriefcaseDb | Determines if the schemas in the Db must or can be upgraded by comparing them with those included in the |
Properties
| Name | Type | Description | |
|---|---|---|---|
| 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 | BriefcaseDb | |
| briefcaseId Readonly Inherited | number | BriefcaseDb | |
| channels Readonly Inherited | ChannelControl | BriefcaseDb | |
| cloudContainer Accessor Inherited ReadOnly | undefined | CloudSqlite.CloudContainer | BriefcaseDb | get the cloud container for this iModel, if it was opened from one |
| codeSpecs Accessor Inherited ReadOnly | CodeSpecs | BriefcaseDb | Get the CodeSpecs in this IModel. |
| codeValueBehavior Accessor Inherited | "exact" | "trim-unicode-whitespace" | BriefcaseDb | 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" | BriefcaseDb | |
| elements Readonly Inherited | IModelDb.Elements | BriefcaseDb | |
| fontMap Accessor Inherited ReadOnly | FontMap | BriefcaseDb | |
| fonts Accessor Inherited ReadOnly | IModelDbFonts | BriefcaseDb | Provides methods for interacting with font-related information stored in this iModel. |
| holdsSchemaLock Accessor Inherited ReadOnly | boolean | BriefcaseDb | determine whether the schema lock is currently held for this iModel. |
| iModelId Accessor Inherited ReadOnly | string | BriefcaseDb | The Guid that identifies this iModel. |
| isBriefcase Accessor Inherited ReadOnly | boolean | BriefcaseDb | override superclass method |
| isReadonly Accessor Inherited ReadOnly | boolean | BriefcaseDb | Check if this iModel has been opened read-only or not. |
| isSnapshot Accessor Inherited ReadOnly | boolean | BriefcaseDb | Returns true if this is a SnapshotDb |
| iTwinId Accessor Inherited ReadOnly | string | BriefcaseDb | The Guid that identifies the context that owns this iModel. GuidString | undefined for the superclass, but required for BriefcaseDb |
| jsClassMap Accessor Inherited ReadOnly | EntityJsClassMap | BriefcaseDb | Allows registering js classes mapped to ECClasses |
| locks Accessor Inherited ReadOnly | LockControl | BriefcaseDb | The LockControl that orchestrates concurrent editing of this iModel. |
| maxLimit Static Readonly Inherited | "10000" | BriefcaseDb | |
| models Readonly Inherited | IModelDb.Models | BriefcaseDb | |
| onBeforeClose Readonly Inherited | BeEvent<() => void> | BriefcaseDb | Event called when the iModel is about to be closed. |
| onChangesetApplied Readonly Inherited | BeEvent<() => void> | BriefcaseDb | Event called after a changeset is applied to this IModelDb. |
| onClosed Readonly Inherited | BeEvent<() => void> | BriefcaseDb | Event raised after a BriefcaseDb has been closed. |
| onOpen Static Readonly Inherited | BeEvent<(_args: OpenBriefcaseArgs) => void> | BriefcaseDb | Event raised just before a BriefcaseDb is opened. |
| onOpened Static Readonly Inherited | BeEvent<(_iModelDb: BriefcaseDb, _args: OpenBriefcaseArgs) => void> | BriefcaseDb | Event raised just after a BriefcaseDb is opened. |
| pathName Accessor Inherited ReadOnly | string | BriefcaseDb | Get the full path fileName of this iModelDb |
| relationships Accessor Inherited ReadOnly | Relationships | BriefcaseDb | Get the linkTableRelationships for this IModel |
| schemaContext Accessor Inherited ReadOnly | SchemaContext | BriefcaseDb | Gets the context that allows accessing the metadata (ecschema-metadata package) of this iModel |
| schemaMap Accessor Inherited ReadOnly | SchemaMap | BriefcaseDb | Allows locally registering a schema for this imodel, in constrast to [Schemas.registerSchema] which is a global operation |
| tiles Readonly Inherited | IModelDb.Tiles | BriefcaseDb | |
| txns Readonly Inherited | TxnManager | BriefcaseDb | Manages local changes to this briefcase. |
| views Readonly Inherited | IModelDb.Views | BriefcaseDb | |
| workspace Accessor Inherited ReadOnly | Workspace | BriefcaseDb | Get the Workspace for this iModel. |
Defined in
- core/backend/src/IModelDb.ts Line 3883
Last Updated: 29 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.