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 BriefcaseDb.onOpen and BriefcaseDb.onOpened.

Extends

Methods

Name Description
abandonChanges(): void Abandon pending changes in this iModel.  
pullAndMergeChanges(requestContext: AuthorizedClientRequestContext, version: IModelVersion = ...): Promise<ChangesetIndexAndId> Pull and Merge changes from iModelHub  
pushChanges(requestContext: AuthorizedClientRequestContext, description: string, _unused?: any): Promise<ChangesetIndexAndId> Push changes to iModelHub.  
reinstateChanges(requestContext: AuthorizedClientRequestContext, version: IModelVersion = ...): Promise<void> Reinstate a previously reversed set of changes  
reverseChanges(requestContext: AuthorizedClientRequestContext, version: IModelVersion = ...): Promise<void> Reverse a previously applied set of changes  
saveChanges(description?: string): void Commit pending changes to this iModel.  
findByKey(key: string): BriefcaseDb Static Find an open IModelDb by its key.  
open(requestContext: ClientRequestContext, args: OpenBriefcaseProps): 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(requestContext: AuthorizedClientRequestContext, briefcase: LocalBriefcaseProps & OpenBriefcaseProps): Promise<void> Static Upgrades the schemas in the iModel based on the current version of the software.  

Inherited methods

Name Inherited from Description
cancelSnap(sessionId: string): void IModelDb Cancel a previously requested snap.
cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Point3d): Point3d IModelDb 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<T>>(props: EntityProps): T 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: Readonly<WritableXYAndZ>, result?: Point3d): Point3d IModelDb Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its IModelDb.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<undefined | Uint8Array> IModelDb Generate graphics for an element or geometry stream.
getBriefcaseId(): number IModelDb Get the briefcase Id of this iModel
getEcefTransform(): Transform IModelDb 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(): string 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 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 IModelDb Return a token for RPC operations.
importSchemas(requestContext: ClientRequestContext, schemaFileNames: string[]): Promise<void> IModelDb Import an ECSchema.
isBriefcaseDb(): this is BriefcaseDb IModelDb Type guard for instanceof BriefcaseDb
isSnapshotDb(): this is SnapshotDb IModelDb Type guard for instanceof SnapshotDb
prepareStatement(sql: string): ECSqlStatement IModelDb Prepare an ECSQL statement.
query(ecsql: string, bindings?: object | any[], limitRows?: number, quota?: QueryQuota, priority?: QueryPriority, abbreviateBlobs?: boolean): 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): undefined | Uint8Array IModelDb Query a "file property" from this iModel, as a blob.
queryFilePropertyString(prop: FilePropertyProps): undefined | string 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?: object | any[]): Promise<number> IModelDb Compute number of rows that would be returned by the ECSQL.
querySchemaVersion(schemaName: string): undefined | string 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?: object | any[], limitRows?: number, quota?: QueryQuota, priority?: QueryPriority): AsyncIterableIterator<any> IModelDb Execute a query and stream its results
saveFileProperty(prop: FilePropertyProps, strValue: undefined | string, blobVal?: Uint8Array): DbResult IModelDb Save a "file property" to this iModel
setEcefLocation(ecef: EcefLocationProps): void IModelDb Set the EcefLocation for this iModel.
setGeographicCoordinateSystem(geoCRS: GeographicCRSProps): void IModelDb Sets the geographic coordinate reference system from GeographicCRSProps.
spatialToCartographicFromEcef(spatial: Readonly<WritableXYAndZ>, result?: Cartographic): Cartographic IModelDb Convert a point in this iModel's Spatial coordinates to a Cartographic using its ecefLocation.
spatialToEcef(spatial: Readonly<WritableXYAndZ>, result?: Point3d): Point3d IModelDb Convert a point in this iModel's Spatial coordinates to an ECEF point using its ecefLocation.
tryPrepareStatement(sql: string): undefined | ECSqlStatement 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: Range3d): 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): undefined | IModelDb 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: string): string Static IModelDb 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
allowLocalChanges Accessor ReadOnly boolean Returns true if this is briefcaseDb is opened writable and can be used to make changesets  
briefcaseId Readonly number    
concurrencyControl Readonly ConcurrencyControl Get the ConcurrencyControl for this iModel. Beta  
contextId Accessor ReadOnly string The Guid that identifies the context that owns this iModel.  
isBriefcase Accessor ReadOnly boolean override superclass method  
onOpen StaticReadonly BeEvent<(_requestContext: ClientRequestContext, _props: IModelRpcProps) => void> Event raised just before a BriefcaseDb is opened.  
onOpened StaticReadonly BeEvent<(_requestContext: ClientRequestContext, _imodelDb: BriefcaseDb) => void> Event raised just after a BriefcaseDb is opened.  
txns Readonly TxnManager Manages local changes to this briefcase.  

Inherited properties

Name Type Inherited from Description
_concurrentQueryStats Protected { dispose: () => void, lastActivityTime: number, logTimerHandle: any, resetTimerHandle: any } IModelDb  
_edit ProtectedStaticReadonly "StandaloneEdit" IModelDb  
_fontMap Protected undefined | FontMap IModelDb  
changeset ChangesetIdWithIndex IModelDb  
changeSetId Accessor ReadOnly string IModelDb The Id of the last changeset that was applied to this iModel.
codeSpecs Accessor ReadOnly CodeSpecs IModelDb Get the CodeSpecs in this IModel.
defaultLimit StaticReadonly "1000" IModelDb  
dictionaryId StaticReadonly string IModelDb The Id of the dictionary model.
ecefLocation Accessor undefined | EcefLocation IModelDb The EcefLocation of the iModel in Earth Centered Earth Fixed coordinates.
elements Readonly IModelDb.Elements IModelDb  
fontMap Accessor ReadOnly FontMap IModelDb  
geographicCoordinateSystem Accessor undefined | GeographicCRS IModelDb The geographic coordinate reference system of the iModel.
globalOrigin Accessor Point3d IModelDb An offset to be applied to all spatial coordinates.
iModelId Accessor ReadOnly string IModelDb The Guid that identifies this iModel.
isGeoLocated Accessor ReadOnly boolean IModelDb 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 IModelDb Get the key that was used to open this iModel. This is the value used for Rpc and Ipc communications.
maxLimit StaticReadonly "10000" IModelDb  
models Readonly IModelDb.Models IModelDb  
name Accessor string IModelDb Name of the iModel
onBeforeClose Readonly BeEvent<() => void> IModelDb Event called when the iModel is about to be closed
onChangesetApplied Readonly BeEvent<() => void> IModelDb Event called after a changeset is applied to this IModelDb.
onEcefLocationChanged Readonly BeEvent<(previousLocation: undefined | EcefLocation) => void> IModelDb Event raised after IModelDb.ecefLocation changes.
onGeographicCoordinateSystemChanged Readonly BeEvent<(previousGCS: undefined | GeographicCRS) => void> IModelDb Event raised after IModelDb.geographicCoordinateSystem changes.
onGlobalOriginChanged Readonly BeEvent<(previousOrigin: Point3d) => void> IModelDb Event raised after IModelDb.globalOrigin changes.
onNameChanged Readonly BeEvent<(previousName: string) => void> IModelDb Event raised after IModelDb.name changes.
onProjectExtentsChanged Readonly BeEvent<(previousExtents: Range3d) => void> IModelDb Event raised after IModelDb.projectExtents changes.
onRootSubjectChanged Readonly BeEvent<(previousSubject: RootSubjectProps) => void> IModelDb Event raised after IModelDb.rootSubject changes.
openMode Readonly OpenMode IModelDb The OpenMode used for this IModel.
pathName Accessor ReadOnly string IModelDb Get the full path fileName of this iModelDb
projectExtents Accessor Range3d IModelDb The volume, in spatial coordinates, inside which the entire project is contained.
relationships Accessor ReadOnly Relationships IModelDb Get the linkTableRelationships for this IModel
repositoryModelId StaticReadonly string IModelDb The Id of the repository model.
rootSubject Accessor RootSubjectProps IModelDb The name and description of the root subject of this iModel
rootSubjectId StaticReadonly string IModelDb The Id of the root subject element.
tiles Readonly IModelDb.Tiles IModelDb  
views Readonly IModelDb.Views IModelDb  

Defined in

Last Updated: 29 November, 2022