public override IObjectsDataSet CloneDirtyObjects(IObjectsDataSet rootDataSet) { var clone = new GOUserObjectsDataSet(rootDataSet as ObjectsDataSet); bool completed; foreach (var keyValue in this.GOUserObjects.Where(o => o.Value.IsDirty || o.Value.IsMarkedForDeletion)) { var cloneObject = (GOUserDataObject)keyValue.Value.Clone(false); cloneObject.InternalObjectId = keyValue.Value.InternalObjectId; completed = false; while (!completed) { completed = clone.GOUserObjects.TryAdd(keyValue.Key, cloneObject); } } foreach (var keyValue in this.GOUserObjectInternalIds .Where(o => this.GOUserObjects[o.Value].IsDirty || this.GOUserObjects[o.Value].IsMarkedForDeletion)) { completed = false; var count = 0; while (!completed && count++ < 15) { completed = clone.GOUserObjectInternalIds.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 GOUserObjectsDataSet(rootDataSet as ObjectsDataSet); bool completed; foreach (var keyValue in this.GOUserObjects) { var cloneObject = (GOUserDataObject)keyValue.Value.Clone(false); cloneObject.InternalObjectId = keyValue.Value.InternalObjectId; completed = false; var count = 0; while (!completed && count++ < 15) { completed = clone.GOUserObjects.TryAdd(keyValue.Key, cloneObject); } } foreach (var keyValue in this.GOUserObjectInternalIds) { completed = false; var count = 0; while (!completed && count++ < 15) { completed = clone.GOUserObjectInternalIds.TryAdd(keyValue.Key, keyValue.Value); } } foreach (var fkKeyValue in this.UserProfile_FKIndex) { var iscompleted = false; var count2 = 0; while (!iscompleted && count2++ < 15) { iscompleted = clone.UserProfile_FKIndex.TryAdd(fkKeyValue.Key, new List <int>()); } foreach (var pk in fkKeyValue.Value) { clone.UserProfile_FKIndex[fkKeyValue.Key].Add(pk); } } return(clone); }