Created
February 26, 2012 17:25
-
-
Save peschkaj/1917854 to your computer and use it in GitHub Desktop.
Potential CorrugatedIron conflict resolution mechanism
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate T ResolveConflict<out T>(RiakObject theObject); | |
public T GetObject<T>(DeserializeObject<T> deserializeObject, ResolveConflict<T> resolveConflict = null) | |
{ | |
if (deserializeObject == null) | |
{ | |
throw new ArgumentException("deserializeObject must not be null"); | |
} | |
if (Siblings.Count > 1 && resolveConflict != null) | |
{ | |
return resolveConflict(this); | |
} | |
return deserializeObject(Value, ContentType); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate T ResolveConflict<out T>(List<T> conflictedObjects); | |
public T GetObject<T>(DeserializeObject<T> deserializeObject, ResolveConflict<T> resolveConflict = null) | |
{ | |
if (deserializeObject == null) | |
{ | |
throw new ArgumentException("deserializeObject must not be null"); | |
} | |
if (Siblings.Count > 1 && resolveConflict != null) | |
{ | |
List<T> conflictedObjects = new List<T>(); | |
foreach (var s in this.Siblings) | |
{ | |
conflictedObjects.add(deserializeObject(s.Value, ContentType)); | |
} | |
return resolveConflict(conflictedObjects); | |
} | |
return deserializeObject(Value, ContentType); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment