StandaloneDb Class

Standalone iModels are read/write files that are not managed by iModelHub. They are relevant only 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 iModelHub.

Some additional details. Standalone iModels:

  • always have Guid.empty for their contextId (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
  • may optionally support undo/redo via TxnManager
  • cannot apply a changeset to nor generate a changesets (since there is no timeline from which to get/push changesets)

Extends

Implements

Methods

Name Description
createEmpty(filePath: string, args: CreateEmptyStandaloneIModelProps): StandaloneDb Static Create an empty standalone iModel.  
findByKey(key: string): StandaloneDb Static    
openFile(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, options?: StandaloneOpenOptions): StandaloneDb Static Open a standalone iModel file.  
tryFindByKey(key: string): StandaloneDb | undefined Static    
upgradeSchemas(filePath: string): void Static Upgrades the schemas in the standalone iModel file.  

Inherited methods

Name Inherited from Description
abandonChanges(): void IModelDb Abandon pending changes in this iModel.
cancelSnap(sessionId: string): void IModelDb Cancel a previously requested snap.
cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Point3d): Point3d IModel Convert a Cartographic to a point in this iModel's Spatial coordinates using its ecefLocation.
clearCaches(): void IModelDb Clear all in-memory caches held in this IModelDb.
clearSqliteStatementCache(): void IModelDb Empty the SqliteStatementCache for this iModel.
clearStatementCache(): void IModelDb Empty the ECSqlStatementCache for this iModel.
close(): void IModelDb Close this IModel, if it is currently open.
computeProjectExtents(options?: ComputeProjectExtentsOptions): ComputedProjectExtents IModelDb Compute an appropriate project extents for this iModel based on the ranges of all spatial elements.
constructEntity<T extends Entity>(props: EntityProps): T extends Entity IModelDb Construct an entity (Element or Model) from an iModel.
containsClass(classFullName: string): boolean IModelDb Query if this iModel contains the definition of the specified class.
deleteFileProperty(prop: FilePropertyProps): DbResult IModelDb delete a "file property" from this iModel
ecefToSpatial(ecef: XYAndZ, result?: Point3d): Point3d IModel Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its ecefLocation.
embedFont(prop: FontProps): FontProps IModelDb  
exportGraphics(exportProps: ExportGraphicsOptions): DbResult IModelDb Export meshes suitable for graphics APIs from arbitrary geometry in elements in this IModelDb.
exportPartGraphics(exportProps: ExportPartGraphicsOptions): DbResult IModelDb Exports meshes suitable for graphics APIs from a specified GeometryPart
generateElementGraphics(request: ElementGraphicsRequestProps): Promise<Uint8Array | undefined> IModelDb Generate graphics for an element or geometry stream.
getBriefcaseId(): BriefcaseId IModelDb Get the briefcase Id of this iModel
getEcefTransform(): Transform IModel Get the Transform from this iModel's Spatial coordinates to ECEF coordinates using its ecefLocation.
getGeoCoordinatesFromIModelCoordinates(requestContext: ClientRequestContext, props: string): Promise<GeoCoordinatesResponseProps> IModelDb Get the GeoCoordinate (longitude, latitude, elevation) corresponding to each IModel Coordinate point in the input
getGeometryContainment(requestContext: ClientRequestContext, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> IModelDb Get the clip containment status for the supplied elements
getGuid(): GuidString IModelDb Get the GUID of this iModel.
getIModelCoordinatesFromGeoCoordinates(requestContext: ClientRequestContext, props: string): Promise<IModelCoordinatesResponseProps> IModelDb Get the IModel coordinate corresponding to each GeoCoordinate point in the input
getJsClass<T extends undefined>(classFullName: string): T extends undefined IModelDb Get the JavaScript class that handles a given entity class.
getMassProperties(requestContext: ClientRequestContext, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> IModelDb Get the mass properties for the supplied elements
IModelDb Get metadata for a class.
getRpcProps(): IModelRpcProps IModel Return a token for RPC operations.
importSchemas(requestContext: ClientRequestContext, schemaFileNames: string[]): Promise<void> IModelDb Import an ECSchema.
isBriefcaseDb(): this IModelDb Type guard for instanceof BriefcaseDb
isSnapshotDb(): this IModelDb Type guard for instanceof SnapshotDb
prepareStatement(sql: string): ECSqlStatement IModelDb Prepare an ECSQL statement.
query(ecsql: string, bindings?: any[] | object, limitRows?: number, quota?: QueryQuota, priority?: QueryPriority, abbreviateBlobs?: false | true): AsyncIterableIterator<any> IModelDb Execute a query and stream its results
queryEntityIds(params: EntityQueryParams): Id64Set IModelDb Query for a set of entity ids, given an EntityQueryParams
queryFilePropertyBlob(prop: FilePropertyProps): Uint8Array | undefined IModelDb Query a "file property" from this iModel, as a blob.
queryFilePropertyString(prop: FilePropertyProps): string | undefined IModelDb Query a "file property" from this iModel, as a string.
queryNextAvailableFileProperty(prop: FilePropertyProps): number IModelDb Query for the next available major id for a "file property" from this iModel.
queryRowCount(ecsql: string, bindings?: any[] | object): Promise<number> IModelDb Compute number of rows that would be returned by the ECSQL.
querySchemaVersion(schemaName: string): string | undefined IModelDb Query for a schema of the specified name in this iModel.
readFontJson(): string IModelDb  
requestSnap(requestContext: ClientRequestContext, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> IModelDb  
restartQuery(token: string, ecsql: string, bindings?: any[] | object, limitRows?: number, quota?: QueryQuota, priority?: QueryPriority): AsyncIterableIterator<any> IModelDb Execute a query and stream its results
saveChanges(description?: string): void IModelDb Commit pending changes to this iModel.
saveFileProperty(prop: FilePropertyProps, strValue: string | undefined, blobVal?: Uint8Array): DbResult IModelDb Save a "file property" to this iModel
setEcefLocation(ecef: EcefLocationProps): void IModel Set the EcefLocation for this iModel.
setGeographicCoordinateSystem(geoCRS: GeographicCRSProps): void IModel  
spatialToCartographicFromEcef(spatial: XYAndZ, result?: Cartographic): Cartographic IModel Convert a point in this iModel's Spatial coordinates to a Cartographic using its ecefLocation.
spatialToEcef(spatial: XYAndZ, result?: Point3d): Point3d IModel Convert a point in this iModel's Spatial coordinates to an ECEF point using its ecefLocation.
tryPrepareStatement(sql: string): ECSqlStatement | undefined IModelDb Prepare an ECSQL statement.
updateEcefLocation(ecef: EcefLocation): void IModelDb Update the EcefLocation of this iModel.
updateIModelProps(): void IModelDb Update the IModelProps of this iModel in the database.
updateProjectExtents(newExtents: AxisAlignedBox3d): void IModelDb Update the project extents for this iModel.
withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T IModelDb Use a prepared SQL statement, potentially from the statement cache.
withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T): T IModelDb Use a prepared ECSQL statement, potentially from the statement cache.
withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T IModelDb Prepared and execute a callback on a SQL statement.
withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T): T IModelDb Prepared and execute a callback on an ECSQL statement.
findByFilename(fileName: string): IModelDb | undefined Static IModelDb Find an opened instance of any subclass of IModelDb, by filename
IModelDb Invoke a callback on each property of the specified class, optionally including superclass properties.
getDefaultSubCategoryId(categoryId: Id64String): Id64String Static IModel Get the default subCategoryId for the supplied categoryId
validateSchemas(filePath: string, forReadWrite: boolean): SchemaState Static 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
changeSetId Accessor ReadOnly undefined This property is always undefined as a StandaloneDb does not accept nor generate changesets.  
filePath Accessor ReadOnly string The full path to the standalone iModel file. Deprecated  
isStandalone Accessor ReadOnly boolean    
txns TxnManager   Beta  

Inherited properties

Name Type Inherited from Description
_edit ProtectedStatic "StandaloneEdit" = "StandaloneEdit" IModelDb  
_fontMap Protected undefined | FontMap IModelDb  
codeSpecs Accessor ReadOnly CodeSpecs IModelDb Get the CodeSpecs in this IModel.
contextId Accessor ReadOnly GuidString | undefined IModel The Guid that identifies the context that owns this iModel.
defaultLimit Static 1000 IModelDb  
dictionaryId Static Id64String IModel The Id of the dictionary model.
ecefLocation Accessor ReadOnly EcefLocation | undefined IModel The EcefLocation of the iModel in Earth Centered Earth Fixed coordinates.
elements IModelDb.Elements IModelDb  
fontMap Accessor ReadOnly FontMap IModelDb  
geographicCoordinateSystem Accessor GeographicCRS | undefined IModel  
globalOrigin Accessor Point3d IModel An offset to be applied to all spatial coordinates.
iModelId Accessor ReadOnly GuidString IModelDb The Guid that identifies this iModel.
isBriefcase Accessor ReadOnly boolean IModelDb Returns true if this is a BriefcaseDb
isGeoLocated Accessor ReadOnly boolean IModel True if this iModel has an EcefLocation.
isReadonly Accessor ReadOnly boolean IModelDb Check if this iModel has been opened read-only or not.
isSnapshot Accessor ReadOnly boolean IModelDb Returns true if this is a SnapshotDb
key Accessor ReadOnly string IModel Get the key that was used to open this iModel. This is the value used for Rpc and Ipc communications.
maxLimit Static 10000 IModelDb  
models IModelDb.Models IModelDb  
name string IModel Name of the iModel
onBeforeClose BeEvent<() => void> IModelDb Event called when the iModel is about to be closed
onChangesetApplied BeEvent<() => void> IModelDb Event called after a changeset is applied to this IModelDb.
openMode OpenMode IModel The OpenMode used for this IModel.
pathName Accessor ReadOnly string IModelDb Get the full path fileName of this iModelDb
projectExtents Accessor AxisAlignedBox3d IModel The volume, in spatial coordinates, inside which the entire project is contained.
relationships Accessor ReadOnly Relationships IModelDb Get the linkTableRelationships for this IModel
repositoryModelId Static Id64String IModel The Id of the repository model.
rootSubject RootSubjectProps IModel The name and description of the root subject of this iModel
rootSubjectId Static Id64String IModel The Id of the root subject element.
tiles IModelDb  
views IModelDb.Views IModelDb  

Object Literals

Name Description
_concurrentQueryStats Protected  

Defined in

Last Updated: 22 April, 2021