c# - Sync conflict handling in Azure Mobile Services: ad hoc vs sync handler -


when not using "sync handler", 1 needs catch sync errors push , pull.

push:

samples catch mobileserviceinvalidoperationexception, mobileservicepushfailedexception , exception:

try {   await client.synccontext.pushasync(); } catch (mobileserviceinvalidoperationexception ex) {   // ...push failed   // ...do manual conflict resolution } catch (mobileservicepushfailedexception ex) {   // ...push failed   // ...do manual conflict resolution } catch (exception ex) {   // ...some other failure   } 

pull:

samples catch mobileserviceinvalidoperationexception , exception:

try {   await synctable.pullasync("allitems", synctable.createquery()); } catch (mobileserviceinvalidoperationexception ex) {   // ...pull failed } catch (exception ex) {   // ...some other failure } 

sync handler:

errors processed in .executetableoperationasync(). samples catch mobileserviceconflictexception, mobileservicepreconditionfailedexception , exception.

finally question(s):

i hope covered possible exceptions types above.

if use sync handler, mean don't need try-catch push/pull/purge/etc. operations? samples i've seen little confusing include (ad hoc resolution , sync handler) in same project...

you should place push/pull/etc. operations in try/catch block. there risk exception haven't thought of (including network going away, example) happen.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -