protected internal void RemoveChild(ClientObject obj) { if (base.ObjectData.CollectionData == null) { return; } ObjectPathIdentity objectPathIdentity = obj.Path as ObjectPathIdentity; for (int i = base.ObjectData.CollectionData.Count - 1; i >= 0; i--) { ClientObject clientObject; ObjectPathIdentity objectPathIdentity2; if (base.ObjectData.CollectionData[i] == obj) { if (((ClientObject)base.ObjectData.CollectionData[i]).ParentCollection == this) { ((ClientObject)base.ObjectData.CollectionData[i]).ParentCollection = null; } base.ObjectData.CollectionData.RemoveAt(i); } else if (objectPathIdentity != null && (clientObject = (base.ObjectData.CollectionData[i] as ClientObject)) != null && (objectPathIdentity2 = (clientObject.Path as ObjectPathIdentity)) != null && objectPathIdentity.Identity == objectPathIdentity2.Identity) { if (((ClientObject)base.ObjectData.CollectionData[i]).ParentCollection == this) { ((ClientObject)base.ObjectData.CollectionData[i]).ParentCollection = null; } base.ObjectData.CollectionData.RemoveAt(i); } } }
public virtual void FromJson(JsonReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } if (reader.PeekTokenType() == JsonTokenType.Null) { this.SetAsNull(); reader.ReadObject(); return; } reader.ReadObjectStart(); while (reader.PeekTokenType() != JsonTokenType.ObjectEnd) { string text = reader.PeekName(); if (!this.InitOnePropertyFromJson(text, reader)) { if (text == "_ObjectType_") { reader.ReadName(); reader.ReadObject(); } else if (text == "_ObjectIdentity_") { reader.ReadName(); string identity = reader.ReadString(); ObjectPath objectPath = new ObjectPathIdentity(this.Context, identity); if (this.m_objectData.Path != null) { objectPath.Id = this.m_objectData.Path.Id; } this.m_objectData.Path = objectPath; objectPath.ServerObjectIsNull = new bool?(false); this.Context.AddObjectPath(objectPath); } else if (text == "_ObjectVersion_") { reader.ReadName(); string version = reader.ReadString(); this.m_objectData.Version = version; } else { this.InitNonPropertyFieldFromJson(text, reader); } } } reader.ReadObjectEnd(); }