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.

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

Last Updated: 03 June, 2019