SapphireDb logo SapphireDb

Conflict handling

SapphireDb supports automatic conflict handling to handle conflicts that can occur during offline usage or parallel work on the same object.

Setup

SapphireDb will handle all conflicts that can happen automatically when using SapphireOfflineEntity.
You can optionally control how SapphireDb should behave in case of a merge conflict.
It is necessary to use SapphireOfflineEntity if you want to use the conflict handling, even if you're not using the offline functionality.

Basic usage

\f:(csharp:Entry.cs) public class DemoEntry : SapphireOfflineEntity\n {\n \tpublic string Content { get; set; }\n }

Configure merge conflict handling

\f:(csharp:Entry.cs) public class DemoEntry : SapphireOfflineEntity\n {\n \t[MergeConflictResolutionMode(MergeConflictResolutionMode.ConflictMarkers)]\n \tpublic string Content { get; set; }\n }
Available merge conflict resolution modes are:
  • Database: Take the value that is already stored in database
  • Last: Take the value of the conflicting operation
  • ConflictMarkers: Take both values and add GIT-Merge markers (only works with strings)

Disable auto merge

It is also possible to disable auto merge if its necessary to keep the integrity of objects for examples. It is still necessary to use SapphireOfflineEntity to detect merge conflicts, but instead of resolving a detected merge error an exception is thrown.
\f:(csharp:Entry.cs) [DisableAutoMerge]\n public class DemoEntry : SapphireOfflineEntity\n {\n \tpublic string Content { get; set; }\n }

This website uses Google Analytics. If you want to disable it just unselect the option: