onOpen StaticReadonly

onOpen: BeEvent<(_requestContext: ClientRequestContext, _props: IModelRpcProps) => void> = ...

Event raised just before a BriefcaseDb is opened.

Example:

BriefcaseDb.onOpen.addListener((_requestContext: AuthorizedClientRequestContext | ClientRequestContext, briefcaseProps: IModelRpcProps) => {
  // 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 (briefcaseProps.openMode !== OpenMode.Readonly)
    throw new IModelError(IModelStatus.BadRequest, "Navigator is readonly");
});

Defined in

Last Updated: 11 June, 2024