protected void MergePhase2(Object objectToMerge, Object objectToDelete, MergeHandle mergeHandle, ICUDResult cudResult, ProceedWithMergeHook proceedHook, MergeFinishedCallback mergeFinishedCallback, bool addNewEntitiesToCache) { List <Object> unpersistedObjectsToDelete = new List <Object>(); RemoveUnpersistedDeletedObjectsFromCudResult(cudResult.AllChanges, cudResult.GetOriginalRefs(), unpersistedObjectsToDelete); if (objectToDelete != null) { IList <IObjRef> oriList = OriHelper.ExtractObjRefList(objectToDelete, mergeHandle); AppendDeleteContainers(objectToDelete, oriList, cudResult.AllChanges, cudResult.GetOriginalRefs(), unpersistedObjectsToDelete); } // Store the MergeFinishedCallback from this thread on the stack and set the property null (for following calls): if (GuiThreadHelper.IsInGuiThread()) { GuiThreadHelper.InvokeOutOfGui(delegate() { MergePhase3(objectToMerge, unpersistedObjectsToDelete, cudResult, proceedHook, mergeFinishedCallback, addNewEntitiesToCache); }); } else { MergePhase3(objectToMerge, unpersistedObjectsToDelete, cudResult, proceedHook, mergeFinishedCallback, addNewEntitiesToCache); } }
public IServiceResult GetORIsForServiceRequest(IServiceDescription serviceDescription) { Object service = ServiceByNameProvider.GetService(serviceDescription.ServiceName); if (service == null) { throw new Exception("Service with name '" + serviceDescription.ServiceName + "' not found"); } Object result = serviceDescription.GetMethod(service.GetType()).Invoke(service, serviceDescription.Arguments); IList <IObjRef> objRefs = OriHelper.ExtractObjRefList(result, null); ServiceResult serviceResult = new ServiceResult(); serviceResult.ObjRefs = objRefs; return(serviceResult); }
protected virtual void AddOriModification(Object obj, String memberName, Object value, Object cloneValue, MergeHandle handle) { if (value is IList) { IList list = (IList)value; for (int a = 0, size = list.Count; a < size; a++) { Object objItem = list[a]; MergeOrPersist(objItem, handle); } } else if (value is IEnumerable) { IEnumerator objEnumerator = ((IEnumerable)value).GetEnumerator(); while (objEnumerator.MoveNext()) { Object objItem = objEnumerator.Current; MergeOrPersist(objItem, handle); } } else { MergeOrPersist(value, handle); } try { IList <IObjRef> oldOriList = OriHelper.ExtractObjRefList(cloneValue, handle, handle.oldOriList); IList <IObjRef> newOriList = OriHelper.ExtractObjRefList(value, handle, handle.newOriList); IRelationUpdateItem oriModItem = CreateRUI(memberName, oldOriList, newOriList); if (oriModItem == null) { return; } IList <IUpdateItem> modItemList = AddModification(obj, handle); modItemList.Add(oriModItem); } finally { handle.oldOriList.Clear(); handle.newOriList.Clear(); } }