internal IReadOnlyList <MutableObject> MGetMembers(MutableObjectBase obj) { List <MutableObject> result = new List <MutableObject>(); foreach (var prop in obj.MProperties) { if (prop.CanResolve) { if (prop.IsCollection) { var items = this.GetList <MutableObject>(obj, prop); if (items != null) { foreach (var item in items) { if (item != null && !result.Contains(item)) { result.Add(item); } } } } else { var item = this.GetValue(obj.MId, prop) as MutableObject; if (item != null && !result.Contains(item)) { result.Add(item); } } } } return(result); }
internal MutableModelList <T> GetList <T>(MutableObjectBase obj, ModelProperty property) { Debug.Assert(property.IsCollection); var slot = obj.MId.Descriptor.GetSlot(property); return(MutableModelList <T> .FromGreenList(obj, slot)); }
private void CollectBases(MutableObjectBase obj, List <MutableObject> result) { foreach (var prop in obj.MProperties) { if (prop.IsImport) { if (prop.IsCollection) { var items = this.GetList <MutableObject>(obj, prop); if (items != null) { foreach (var item in items) { if (item != null && !result.Contains(item)) { result.Add(item); } } } } else { var item = this.GetValue(obj.MId, prop) as MutableObject; if (item != null && !result.Contains(item)) { result.Add(item); } } } } }
internal IReadOnlyList <MutableObject> MGetAllBases(MutableObjectBase obj) { List <MutableObject> result = new List <MutableObject>(); this.CollectAllBases(obj, result); result.Remove(obj); return(result); }
internal static MutableModelList <T> FromGreenList(MutableObjectBase obj, Slot slot) { if (slot.IsCollection) { return(new MutableModelListFromGreenList <T>(obj, slot)); } else { return(new MutableModelListFromGreenSingle <T>(obj, slot)); } }
internal object MGet(MutableObjectBase obj, ModelProperty property) { if (property.IsCollection) { return(this.GetList <object>(obj, property)); } else { return(this.GetValue(obj.MId, property)); } }
protected MutableObject CreateObject(ObjectId id) { MutableObjectBase obj = this.model.CreateObject(id, this.flags.HasFlag(ModelFactoryFlags.CreateWeakObjects)); obj.MCallInit(); if (!this.flags.HasFlag(ModelFactoryFlags.DontMakeObjectsCreated)) { obj.MMakeCreated(); } return(obj); }
private void CollectAllBases(MutableObjectBase obj, List <MutableObject> result) { if (obj == null) { return; } if (!result.Contains(obj)) { result.Add(obj); var bases = obj.MGetBases(); foreach (var item in bases) { this.CollectAllBases(item as MutableObjectBase, result); } } }
internal MutableObjectBase CreateObject(ObjectId oid, bool weakReference) { Debug.Assert(oid != null); Debug.Assert(!this.ContainsObject(oid)); MutableObjectBase result = null; result = oid.CreateMutable(this, true); GreenModelUpdateContext ctx = null; try { do { ctx = this.BeginUpdate(); ctx.Updater.AddObject(this.id, oid, weakReference); } while (!this.EndUpdate(ctx)); this.RegisterObject(oid, result); } finally { this.FinalizeUpdate(ctx); } return(result); }
internal MutableModelListFromGreenList(MutableObjectBase obj, Slot slot) { this.obj = obj; this.slot = slot; }
internal MutableModelSetFromGreenSingle(MutableObjectBase obj, Slot slot) { this.obj = obj; this.slot = slot; }