Esempio n. 1
0
        public List <List <EntityBase> > LoadAllRelatedTypes()
        {
            ObjectDescription         od   = ClassFactory.GetObjectDescription(ReflectedType, _ps);
            List <List <EntityBase> > list = new List <List <EntityBase> >();

            foreach (PropertyDescription p in od.Relations)
            {
                List <EntityBase> l = Ps.GetEntities(p.RelatedType);              ////
                list.Add(l);
            }
            return(list);
        }
Esempio n. 2
0
        public void SetOtmRelations(List <EntityBase> entities)
        {
            List <PropertyDescription> props = new List <PropertyDescription>();

            foreach (PropertyDescription p in ClassFactory.GetObjectDescription(ReflectedType, _ps).Relations)
            {
                if (p.IsOneToManyRelation && !p.IsNonPersistent && !p.IsInternal)
                {
                    if (!_ps.IsLoaded(p.RelatedType))
                    {
                        _ps.GetEntities(p.RelatedType);
                    }
                    props.Add(p);
                }
            }

            //SqlDataReader reader;
            foreach (EntityBase entity in entities)
            {
                entity.BeginLoad();
                foreach (PropertyDescription p in props)
                {
                    ObjectDescription        od      = ClassFactory.GetObjectDescription(p.RelatedType, _ps);
                    PropertyDescription      pd      = od.Properties[p.RelationAttribute.RelatedColumn];
                    Indexes                  indexes = _ps.Caches[p.RelatedType].RawIndexes;
                    Cryptany.Core.DPO.Mapper m       = new Mapper(p.RelatedType, _ps);
                    List <EntityBase>        list    = indexes[m[pd.Name]][entity.ID];
                    if (list != null)
                    {
                        foreach (EntityBase e in list)
                        {
                            (p.GetValue(entity) as IList).Add(e);
                        }
                    }
                }
                entity.EndLoad();
            }
        }
Esempio n. 3
0
 public List <EntityBase> GetAllRelatedValues(PersistentStorage ps)
 {
     return(ps.GetEntities(this.RelatedType));
 }