MikeCodesDotNET / App-Service-Helpers

Add data storage and authentication to your app in a few lines of code.
MIT License
79 stars 28 forks source link

Add conflict resolution. #30

Closed pierceboggan closed 8 years ago

pierceboggan commented 8 years ago

This PR brings improved conflict resolution in the form of three strategies:

Users can select a strategy on a per-table basis by setting the ConflictResolutionStrategy property. In the event that users want to handle conflicts on a per-conflict basis (rather than using a overlying strategy for all conflicts), they can set the ConflictResolutionStrategyDelegate, which allows users to return their own ConflictResolutionStrategy. This is great, as users can implement this delegate to ask users which version they prefer, and return the strategy selected by the user.

In both approaches, the developer is not responsible for the actual logic of resolving the conflict, only for selecting which logic (or strategy) to execute.

Note: Because LatestWins will only occur when the client is the offender (e.g. the server wouldn't be throwing the exception to us if they were the last write), selecting this strategy is the equivalent of picking ClientWins.