API Reference > imodeljs-backend > iModels > IModelDb > onOpen onOpen Static onOpen: BeEvent<(_requestContext: AuthorizedClientRequestContext, _contextId: string, _iModelId: string, _openParams: OpenParams, _version: IModelVersion) => void> = new BeEvent<(_requestContext: AuthorizedClientRequestContext, _contextId: string, _iModelId: string, _openParams: OpenParams, _version: IModelVersion) => void>() Event raised just before an IModelDb is opened. note This event is not raised for snapshot IModelDbs. Example: IModelDb.onOpen.addListener((_requestContext: AuthorizedClientRequestContext, _contextId: string, _iModelId: string, openParams: OpenParams, _version: IModelVersion) => { // A read-only service might want to reject all requests to open an iModel for writing. It can do this in the onOpen event. if (openParams.openMode !== OpenMode.Readonly) throw new IModelError(IModelStatus.BadRequest, "Navigator is readonly"); }); Defined in core/backend/src/IModelDb.ts Line 171 Last Updated: 13 June, 2024