Esempio n. 1
0
        public override IObjectsDataSet CloneDirtyObjects(IObjectsDataSet rootDataSet)
        {
            var  clone = new GOUserRoleObjectsDataSet(rootDataSet as ObjectsDataSet);
            bool completed;

            foreach (var keyValue in this.GOUserRoleObjects.Where(o => o.Value.IsDirty || o.Value.IsMarkedForDeletion))
            {
                var cloneObject = (GOUserRoleDataObject)keyValue.Value.Clone(false);
                cloneObject.InternalObjectId = keyValue.Value.InternalObjectId;

                completed = false;
                while (!completed)
                {
                    completed = clone.GOUserRoleObjects.TryAdd(keyValue.Key, cloneObject);
                }
            }

            foreach (var keyValue in this.GOUserRoleObjectInternalIds
                     .Where(o => this.GOUserRoleObjects[o.Value].IsDirty || this.GOUserRoleObjects[o.Value].IsMarkedForDeletion))
            {
                completed = false;

                var count = 0;
                while (!completed && count++ < 15)
                {
                    completed = clone.GOUserRoleObjectInternalIds.TryAdd(keyValue.Key.Clone(), 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);
        }
Esempio n. 2
0
        public override IObjectsDataSet Clone(IObjectsDataSet rootDataSet)
        {
            var  clone = new GOUserRoleObjectsDataSet(rootDataSet as ObjectsDataSet);
            bool completed;

            foreach (var keyValue in this.GOUserRoleObjects)
            {
                var cloneObject = (GOUserRoleDataObject)keyValue.Value.Clone(false);
                cloneObject.InternalObjectId = keyValue.Value.InternalObjectId;

                completed = false;
                var count = 0;
                while (!completed && count++ < 15)
                {
                    completed = clone.GOUserRoleObjects.TryAdd(keyValue.Key, cloneObject);
                }
            }

            foreach (var keyValue in this.GOUserRoleObjectInternalIds)
            {
                completed = false;
                var count = 0;
                while (!completed && count++ < 15)
                {
                    completed = clone.GOUserRoleObjectInternalIds.TryAdd(keyValue.Key.Clone(), keyValue.Value);
                }
            }

            foreach (var fkKeyValue in this.Role_FKIndex)
            {
                var iscompleted = false;
                var count2      = 0;
                while (!iscompleted && count2++ < 15)
                {
                    iscompleted = clone.Role_FKIndex.TryAdd(fkKeyValue.Key, new List <int>());
                }

                foreach (var pk in fkKeyValue.Value)
                {
                    clone.Role_FKIndex[fkKeyValue.Key].Add(pk);
                }
            }

            foreach (var fkKeyValue in this.User_FKIndex)
            {
                var iscompleted = false;
                var count2      = 0;
                while (!iscompleted && count2++ < 15)
                {
                    iscompleted = clone.User_FKIndex.TryAdd(fkKeyValue.Key, new List <int>());
                }

                foreach (var pk in fkKeyValue.Value)
                {
                    clone.User_FKIndex[fkKeyValue.Key].Add(pk);
                }
            }


            return(clone);
        }