Пример #1
0
 internal void Load(IDataReader reader, DataObjectList dstObjs, LoadContext loadContext)
 {
     object[] values = new object[reader.FieldCount];
     while (reader.Read())
     {
         reader.GetValues(values);
         DataId id = new DataId((string)values[0]);
         if (this.LoadedObjects[(object)id] == null)
         {
             DataObject dataObject = this.FStorage.EnsureCacheItem(id);
             if (!dataObject.IsDeleted)
             {
                 int index = 0;
                 int num   = 1;
                 for (; index < this.ObjectLoader.Count; ++index)
                 {
                     ObjectPartLoader objectPartLoader = this.ObjectLoader[index];
                     object           obj     = objectPartLoader.FieldName != null ? values[num++] : (object)null;
                     object           exValue = objectPartLoader.ExFieldName != null ? values[num++] : (object)null;
                     objectPartLoader.Load(dataObject, obj, exValue, loadContext);
                 }
                 dstObjs?.Add((object)dataObject);
             }
             this.LoadedObjects.Add((object)dataObject.Id, (object)dataObject);
             dataObject.IncludeSessionState(ObjectSessionState.Existing);
         }
     }
     if (loadContext != LoadContext.FetchAllObjects)
     {
         return;
     }
     for (int index1 = 0; index1 < this.ObjectLoader.Count; ++index1)
     {
         if (this.ObjectLoader[index1] is LinkPropertyLoader linkPropertyLoader && linkPropertyLoader.Association.Property.IsAggregation)
         {
             for (int index2 = 0; index2 < linkPropertyLoader.RefLoaders.Length; ++index2)
             {
                 MetadataClass cls = linkPropertyLoader.RefLoaders[index2].Class;
                 this.FStorage.Session[cls].CompleteChildLists(cls.Childs.Need(this.Class));
             }
         }
     }
 }
Пример #2
0
        public override object GetValue(DataObject obj)
        {
            DataObjectList dataObjectList1 = new DataObjectList();

            dataObjectList1.Add((object)obj);
            DataObjectList dataObjectList2 = dataObjectList1;

            foreach (Navigator navigator in this.FNavigation)
            {
                DataObjectList navigableObjects = new DataObjectList();
                foreach (DataObject sourceObject in (ArrayList)dataObjectList2)
                {
                    navigator.GetNavigableObjects(sourceObject, navigableObjects);
                }
                dataObjectList2 = navigableObjects;
            }
            List <object> values = new List <object>();

            foreach (DataObject dataObject in (ArrayList)dataObjectList2)
            {
                values.Add(this.FMemberValueGetter.GetValue(dataObject));
            }
            return(this.FValueCardinality.GetValue(values));
        }