Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Potential CorrugatedIron conflict resolution mechanism
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);
}
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