public override IObjectsDataSet CloneDirtyObjects(IObjectsDataSet rootDataSet) { var clone = new PlaceObjectsDataSet(rootDataSet as ObjectsDataSet); bool completed; foreach (var keyValue in this.PlaceObjects.Where(o => o.Value.IsDirty || o.Value.IsMarkedForDeletion)) { var cloneObject = (PlaceDataObject)keyValue.Value.Clone(false); cloneObject.InternalObjectId = keyValue.Value.InternalObjectId; completed = false; while (!completed) { completed = clone.PlaceObjects.TryAdd(keyValue.Key, cloneObject); } } foreach (var keyValue in this.PlaceObjectInternalIds .Where(o => this.PlaceObjects[o.Value].IsDirty || this.PlaceObjects[o.Value].IsMarkedForDeletion)) { completed = false; var count = 0; while (!completed && count++ < 15) { completed = clone.PlaceObjectInternalIds.TryAdd(keyValue.Key, keyValue.Value); } } // CloneDirtyObjects is used to pass only dirty objects to server to save changes. Since indexes are not serialized, no need to clone them return(clone); }
public override IObjectsDataSet Clone(IObjectsDataSet rootDataSet) { var clone = new PlaceObjectsDataSet(rootDataSet as ObjectsDataSet); bool completed; foreach (var keyValue in this.PlaceObjects) { var cloneObject = (PlaceDataObject)keyValue.Value.Clone(false); cloneObject.InternalObjectId = keyValue.Value.InternalObjectId; completed = false; var count = 0; while (!completed && count++ < 15) { completed = clone.PlaceObjects.TryAdd(keyValue.Key, cloneObject); } } foreach (var keyValue in this.PlaceObjectInternalIds) { completed = false; var count = 0; while (!completed && count++ < 15) { completed = clone.PlaceObjectInternalIds.TryAdd(keyValue.Key, keyValue.Value); } } return(clone); }