示例#1
0
        public CInfoChampDynamique Clone()
        {
            CInfoChampDynamique info = new CInfoChampDynamique(
                NomChamp,
                TypeDonnee,
                NomPropriete,
                Rubrique,
                StructureValeur);

            return(info);
        }
示例#2
0
        ////////////////////////////////////////////
        public static CInfoStructureDynamique GetStructure(Type tp, int nDepth)
        {
            if (GetStructureSurchargee != null)
            {
                CInfoStructureDynamique info = GetStructureSurchargee(tp, nDepth);
                if (info != null)
                {
                    info.m_type = tp;
                }
                return(info);
            }
            if (nDepth < 0)
            {
                return(null);
            }
            object[] attribs = tp.GetCustomAttributes(typeof(DynamicClassAttribute), true);
            CInfoStructureDynamique infoStructure = new CInfoStructureDynamique();

            infoStructure.m_type = tp;
            if (attribs.Length != 0)
            {
                infoStructure.NomConvivial = ((DynamicClassAttribute)attribs[0]).NomConvivial;
            }

            foreach (PropertyInfo property in tp.GetProperties())
            {
                attribs = property.GetCustomAttributes(typeof(DynamicFieldAttribute), true);
                if (attribs.Length > 0)
                {
                    DynamicFieldAttribute fieldAttr = (DynamicFieldAttribute)attribs[0];
                    tp = property.PropertyType;
                    CInfoStructureDynamique infoFils = GetStructure(tp, nDepth - 1);
                    if (infoFils != null && infoFils.Champs.Count == 0)
                    {
                        infoFils = null;
                    }
                    CInfoChampDynamique info = new CInfoChampDynamique(
                        fieldAttr.NomConvivial,
                        tp,
                        property.Name,
                        "",
                        infoFils);
                    infoStructure.Champs.Add(info);
                }
            }
            return(infoStructure);
        }
示例#3
0
 public void InsereParent(CInfoChampDynamique info)
 {
     m_strNomPropriete = info.NomPropriete + "." + NomPropriete;
     m_strNomChamp     = m_strNomChamp + " " + info.NomChamp;
 }