Developer

Merge Algorithm

The heuristic used by the Offline Store to compute the fixed requests attempts to merge the details of new requests as far forward as possible, in order to replace any incorrect data in the original requests with correct data.

Here are some common scenarios:
  • Fixing the properties of a failed POST request A subsequent PATCH can be made to the entity with the corrected values. The merge heuristic combines the PATCH and POST requests into a single new POST request containing the corrected values.
  • Fixing the properties of a failed PATCH request A subsequent PATCH can be made to the entity with the corrected values. The merge heuristic combines both PATCH requests into a single new PATCH request containing the corrected values.
  • Discarding a failed POST request A subsequent DELETE can be made to the entity. The merge heuristic deletes the original POST request and nothing is sent to the back end.
  • Fixing a PATCH or DELETE request that failed due to a stale ETag The application can perform a refresh operation to download the fresh entity data and ETag. The merge heuristic replaces the stale ETag in the failed request with the fresh one and resends the request.

When requests that contain custom headers are merged together, then the merged request has a union of the custom headers. If the same custom header is specified by multiple requests, then the header value of the last request takes precedence.

When requests that contain custom tags are merged together, then the merged request has a custom tag formed by concatenating all of the custom tags together and using a hash symbol (#) as a delimiter.

The merge heuristic is not limited to fixing simple modifications to Entities. If other OData operations (such as modifying links, entity bindings, deep inserts, batch change sets, and media streams) result in failures during a flush, they can also be fixed by applying subsequent modification requests.