Beispiel #1
0
 //----------------------------------------------------
 public void Init(CObjetDonnee objetRacine)
 {
     m_entitesManager = new CEntitiesManager(objetRacine.ContexteDonnee.IdSession);
     m_entitesManager.IndicateurProgression = m_lblProgression;
     if (m_configParDefaut != null)
     {
         m_entitesManager.ConfigurationRecherche = CCloner2iSerializable.CloneGeneric <CConfigurationRechercheEntites>(m_configParDefaut);
     }
     m_objetRacine = objetRacine;
     m_pileObjets.Push(objetRacine);
     ShowObjetCourant();
 }
        //--------------------------------------------------------------
        public List <CReferenceObjetDependant> GetDependances(CEntitiesManager manager, CObjetDonnee objet)
        {
            objet.Refresh();
            List <CReferenceObjetDependant> lst = new List <CReferenceObjetDependant>();

            if (objet == null)
            {
                return(lst);
            }
            Type tp = objet.GetType();

            foreach (PropertyInfo info in tp.GetProperties())
            {
                if (info.GetCustomAttribute <BlobDecoderAttribute>(true) != null)
                {
                    try
                    {
                        DynamicFieldAttribute df = info.GetCustomAttribute <DynamicFieldAttribute>();
                        string        strNomProp = df == null?info.Name:df.NomConvivial;
                        MethodInfo    methode    = info.GetGetMethod();
                        List <CDbKey> lstKeys    = new List <CDbKey>();
                        using (CDbKeyReaderTracker tracker = new CDbKeyReaderTracker())
                        {
                            if (methode != null)
                            {
                                methode.Invoke(objet, new object[0]);
                            }
                            ;
                            lstKeys.AddRange(tracker.TrackedKeys);
                        }
                        foreach (CDbKey key in lstKeys)
                        {
                            Type tpChild = manager.GetTypeForUniversalId(key.StringValue);
                            if (tpChild != null && !manager.ConfigurationRecherche.IsIgnore(tpChild))
                            {
                                lst.Add(new CReferenceObjetDependant(strNomProp, tpChild, key));
                            }
                        }
                    }
                    catch { }
                }
            }
            return(lst);
        }
Beispiel #3
0
        //----------------------------------------------------------------------
        public List <CReferenceObjetDependant> GetDependances(CEntitiesManager manager, CObjetDonnee objet)
        {
            List <CReferenceObjetDependant> lstRefs = new List <CReferenceObjetDependant>();

            if (objet == null)
            {
                return(lstRefs);
            }
            Type tpObjet = objet.GetType();
            List <MethodInfo> lstMethodes = new List <MethodInfo>();

            foreach (MemberInfo member in from m in tpObjet.GetMembers() where
                     m.GetCustomAttribute <DependanceObjetDonneeAttribute>(true) != null
                     select m)
            {
                MethodInfo method = member as MethodInfo;
                if (method == null && member is PropertyInfo)
                {
                    method = ((PropertyInfo)member).GetGetMethod();
                }
                string strNom = member.Name;
                DynamicFieldAttribute fieldAtt = member.GetCustomAttribute <DynamicFieldAttribute>(true);
                if (fieldAtt != null)
                {
                    strNom = fieldAtt.NomConvivial;
                }
                if (method != null)
                {
                    try
                    {
                        CObjetDonnee dep = method.Invoke(objet, new object[0]) as CObjetDonnee;
                        if (dep != null)
                        {
                            lstRefs.Add(new CReferenceObjetDependant(strNom, dep));
                        }
                    }
                    catch {}
                }
            }
            return(lstRefs);
        }
 //--------------------------------------------------------------
 public static void Autoexec()
 {
     CEntitiesManager.RegisterFournisseurDependances(typeof(CFournisseurDependancesInBlob));
 }
Beispiel #5
0
 //----------------------------------------------------------------------
 public static void Autoexec()
 {
     CEntitiesManager.RegisterFournisseurDependances(typeof(DependanceObjetDonneeAttribute));
 }