private bool HandleMissingObjectInOther(object obj, IReplicationReference ownerRef , IReplicationProviderInside owner, IReplicationProviderInside other, object referencingObject , string fieldName) { bool isConflict = false; bool wasModified = owner.WasModifiedSinceLastReplication(ownerRef); if (wasModified) { isConflict = true; } if (_directionTo == other) { isConflict = true; } object prevailing = null; //by default, deletion prevails if (isConflict) { owner.Activate(obj); } _event.ResetAction(); _event.Conflict(isConflict); _event._creationDate = TimeStampIdGenerator.IdToMilliseconds(ownerRef.Uuid().GetLongPart ()); long modificationDate = TimeStampIdGenerator.IdToMilliseconds(ownerRef.Version()); if (owner == _providerA) { _stateInA.SetAll(obj, false, wasModified, modificationDate); _stateInB.SetAll(null, false, false, ObjectStateImpl.Unknown); } else { //owner == _providerB _stateInA.SetAll(null, false, false, ObjectStateImpl.Unknown); _stateInB.SetAll(obj, false, wasModified, modificationDate); } _listener.OnReplicate(_event); if (isConflict && !_event._actionWasChosen) { ThrowReplicationConflictException(); } if (_event._actionWasChosen) { if (_event._actionChosenState == null) { return(false); } if (_event._actionChosenState == _stateInA) { prevailing = _stateInA.GetObject(); } if (_event._actionChosenState == _stateInB) { prevailing = _stateInB.GetObject(); } } if (prevailing == null) { //Deletion has prevailed. if (_directionTo == other) { return(false); } ownerRef.MarkForDeleting(); return(!_event._actionShouldStopTraversal); } bool needsToBeActivated = !isConflict; //Already activated if there was a conflict. return(HandleNewObject(obj, ownerRef, owner, other, referencingObject, fieldName, needsToBeActivated, true)); }
private bool HandleMissingObjectInOther(object obj, IReplicationReference ownerRef , IReplicationProviderInside owner, IReplicationProviderInside other, object referencingObject , string fieldName) { bool isConflict = false; bool wasModified = owner.WasModifiedSinceLastReplication(ownerRef); if (wasModified) { isConflict = true; } if (_directionTo == other) { isConflict = true; } object prevailing = null; //by default, deletion prevails if (isConflict) { owner.Activate(obj); } _event.ResetAction(); _event._isConflict = isConflict; _event._creationDate = TimeStampIdGenerator.IdToMilliseconds(ownerRef.Uuid().GetLongPart ()); long modificationDate = TimeStampIdGenerator.IdToMilliseconds(ownerRef.Version()); if (owner == _providerA) { _stateInA.SetAll(obj, false, wasModified, modificationDate); _stateInB.SetAll(null, false, false, -1); } else { //owner == _providerB _stateInA.SetAll(null, false, false, -1); _stateInB.SetAll(obj, false, wasModified, modificationDate); } _listener.OnReplicate(_event); if (isConflict && !_event._actionWasChosen) { ThrowReplicationConflictException(); } if (_event._actionWasChosen) { if (_event._actionChosenState == null) { return false; } if (_event._actionChosenState == _stateInA) { prevailing = _stateInA.GetObject(); } if (_event._actionChosenState == _stateInB) { prevailing = _stateInB.GetObject(); } } if (prevailing == null) { //Deletion has prevailed. if (_directionTo == other) { return false; } ownerRef.MarkForDeleting(); return !_event._actionShouldStopTraversal; } bool needsToBeActivated = !isConflict; //Already activated if there was a conflict. return HandleNewObject(obj, ownerRef, owner, other, referencingObject, fieldName, needsToBeActivated, true); }