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 IModelHubError if some or all requests could not be fulfilled. The error object will identify the locks and/or codes that are unavailable.

Example:


try {
  await briefcaseDb.concurrencyControl.request(authorizedRequestContext);
  authorizedRequestContext.enter();
} 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.
  briefcaseDb.abandonChanges();
  return;
}

Note that this function will request resources even in bulk mode.

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

throws IModelHubError 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. See ConcurrencyControl.requestResources for a convenience method that builds and makes a request in one step.

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.

Returns - Promise<void>

Defined in

Last Updated: 29 November, 2022