Пример #1
0
        internal ImmutableModelList <ImmutableObject> MGetMembers(ObjectId oid)
        {
            GreenList result = GreenList.EmptyUnique;

            foreach (var prop in this.MProperties(oid))
            {
                if (prop.CanResolve)
                {
                    if (prop.IsCollection)
                    {
                        var items = this.GetGreenValue(oid, prop) as GreenList;
                        if (items != null)
                        {
                            result = result.AddRange(items);
                        }
                    }
                    else
                    {
                        var item = this.GetGreenValue(oid, prop);
                        result = result.Add(item);
                    }
                }
            }
            return(ImmutableModelList <ImmutableObject> .FromGreenList(result, this, oid));
        }
Пример #2
0
        internal ImmutableModelList <ImmutableObject> MGetBases(ObjectId oid)
        {
            GreenList result = this.CollectBases(oid);

            result = result.Remove(oid);
            return(ImmutableModelList <ImmutableObject> .FromGreenList(result, this, oid));
        }
Пример #3
0
        internal ImmutableModelList <ImmutableObject> MGetAllBases(ObjectId oid)
        {
            GreenList result = GreenList.EmptyUnique;

            this.CollectAllBases(oid, ref result);
            result = result.Remove(oid);
            return(ImmutableModelList <ImmutableObject> .FromGreenList(result, this, oid));
        }
Пример #4
0
        internal ImmutableModelList <T> GetList <T>(ObjectId oid, ModelProperty property)
        {
            Debug.Assert(property.IsCollection);
            var greenValue = this.GetGreenValue(oid, property);

            if (greenValue is GreenList)
            {
                return(ImmutableModelList <T> .FromGreenList((GreenList)greenValue, this, oid));
            }
            else
            {
                Slot slot = oid.Descriptor.GetSlot(property);
                if (!slot.IsCollection)
                {
                    return(ImmutableModelList <T> .FromGreenSingleValue(greenValue, this, oid));
                }
            }
            return(ImmutableModelList <T> .FromGreenList(property.IsUnique?GreenList.EmptyUnique : GreenList.EmptyNonUnique, this, oid));
        }