request Method

Try to acquire locks and/or reserve codes from iModelHub. This function may fulfill some requests and fail to fulfill others. This function returns a rejection of type RequestError if some or all requests could not be fulfilled. The error object will identify the locks and/or codes that are unavailable.


    // Now acquire all locks and reserve all codes needed.
    // This is a *perquisite* to saving local changes.
    try {
      await iModel.concurrencyControl.request(authorizedRequestContext);
    } catch (err) {
      // If we can't get *all* of the locks and codes that are needed,
      // then we can't go on with this transaction as is.
      // We could possibly make additional changes to remove the need
      // for the resources that are unavailable. In this case,
      // we will just bail out and print a message.
      // report error ...
    // Now we can commit the local changes to a local transaction in the
    // IModelDb.

request(requestContext: AuthorizedClientRequestContext, req?: ConcurrencyControl.Request): Promise<void>

throws ConcurrencyControl.RequestError if some or all of the request could not be fulfilled by iModelHub.

throws IModelError if the IModelDb is not open or is not connected to an iModel. See CodeHandler and LockHandler for details on what errors may be thrown.

Parameter Type Description
requestContext AuthorizedClientRequestContext The client request context
req ConcurrencyControl.Request The requests to be sent to iModelHub. If undefined, all pending requests are sent to iModelHub.

Defined in

Last Updated: 13 October, 2019