Exemple #1
0
        private void InitObjectSetupCollection(INakedObject nakedObject, ObjectData data, INakedObjectAssociation field)
        {
            /*
             * The internal collection is already a part of the object, and therefore cannot be recreated, but its
             * oid must be set
             */
            IList <IOid> refs       = (IList <IOid>)data.GetField(field.Id) ?? new List <IOid>();
            INakedObject collection = field.GetNakedObject(nakedObject);

            collection.ResolveState.Handle(Events.StartResolvingEvent);

            var elements = new List <INakedObject>();

            foreach (IOid elementOid in refs)
            {
                INakedObject adapter = Persistor.GetAdapterFor(elementOid) ?? GetObject(elementOid, null);
                elements.Add(adapter);
            }
            ICollectionFacet facet = collection.GetCollectionFacetFromSpec();

            facet.Init(collection, elements.ToArray());
            collection.ResolveState.Handle(Events.EndResolvingEvent);
        }