Set the concurrency control policy. Before changing from optimistic to pessimistic, all local changes must be saved and uploaded to iModelHub. Before changing the locking policy of the pessimistic concurrency policy, all local changes must be saved to the IModelDb. Here is an example of setting an optimistic policy:
// Turn on optimistic concurrency control. // This allows the app to modify elements, models, etc. without first acquiring locks. // Later, when the app downloads and merges changeSets from iModelHub, // IModelDb's ConcurrencyControl will merge changes and handle conflicts, // as specified by this policy. iModel.concurrencyControl.setPolicy(new ConcurrencyControl.OptimisticPolicy());
throws IModelError if the policy cannot be set.
|policy||ConcurrencyControl.PessimisticPolicy | ConcurrencyControl.OptimisticPolicy||The policy to used|
Last Updated: 13 October, 2019