javascript - Conflict resolution with breeze -
how can conflict resolution achieved in breeze.sharp or breeze.js , how compare newly released azure "asynctable" conflict handling?
the scenario this: entity (e.g. person) saved in breeze cache previous fetch server (the reason saving data in cache make possible user work on app while mobile device disconnected internet). while mobile device offline user edits details on person (e.g. edits surname). meanwhile else edits same person's surname , saved azure (or central ms sql) database. mobile device comes online again , sends update (which has been stored in local cache until now) server.
my question is, how can/should done breeze open possibility pick "winner" between these 2 conflicting updates? mechanism deciding winner not issue here. i'd know how best opportunity make decision - , how let winner's version of surname persisted on loser's side (i.e. mobile device or server db).
the closest managed answer in breeze documentation on "saving changes" page says "this page not ready publication. cover: ... concurrency , dataproperty.concurrencymode".
i not sure whether requirement can implemented through optimistic concurrency or whether more akin azure way of approaching (version fields on entities , other unbeknownst-to-me magical conflict resolution , sync logic) required make work on breeze?
i'd know how best opportunity make decision - , how let winner's version of surname persisted on loser's side (i.e. mobile device or server db).
i'm using breeze entity framework / ms sql backend. here's how i'm identifying concurrency exceptions on client:
export function isconcurrencyexception(reason: any): boolean { return reason.message && /store update, insert, or delete statement affected unexpected number of rows/.test(reason.message); } entitymanager.savechanges() .fail(reason => { if (isconcurrencyexception(reason)) { // ... concurrency exception handling logic ... } // detect other failure reasons (connection issue, server-side validation error, etc) });
in terms of after you've identified concurrency exception, that's tough, every app different. there's several scenarios consider, ranging non-conflicting property edits, conflicting property edits situations user deleted entity you're trying save. breeze's mergestrategy come play in solution.