コード例 #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);
        }
コード例 #2
0
 public int CountField(INakedObject nakedObject, INakedObjectAssociation association)
 {
     return(association.GetNakedObject(nakedObject).GetAsEnumerable().Count());
 }
コード例 #3
0
        /*
         * The ObjectData holds all references for internal collections, so the object should haves its internal
         * collection populated by this method.
         */

        public virtual void ResolveField(INakedObject nakedObject, INakedObjectAssociation field)
        {
            Log.DebugFormat("ResolveField nakedobject: {0} field: {1}", nakedObject, field);
            field.GetNakedObject(nakedObject);
            ResolveImmediately(nakedObject);
        }