Esempio n. 1
0
        private PropertyInfo getproperty(Type type, string propertyname)
        {
            if (propertyname == "$type")
            {
                return(null);
            }
            StringBuilder sb = new StringBuilder();

            sb.Append(type.Name);
            sb.Append("|");
            sb.Append(propertyname);
            string n = sb.ToString();

            if (_propertycache.ContainsKey(n))
            {
                return(_propertycache[n]);
            }
            else
            {
                PropertyInfo[] pr = type.GetProperties();
                foreach (PropertyInfo p in pr)
                {
                    StringBuilder sbb = new StringBuilder();
                    sbb.Append(type.Name);
                    sbb.Append("|");
                    sbb.Append(p.Name);
                    string nn = sbb.ToString();
                    if (_propertycache.ContainsKey(nn) == false)
                    {
                        _propertycache.Add(nn, p);
                    }
                }
                return(_propertycache[n]);
            }
        }
Esempio n. 2
0
 public List <Getters> GetGetters(Type type)
 {
     if (_getterscache.ContainsKey(type))
     {
         return(_getterscache[type]);
     }
     else
     {
         PropertyInfo[] props   = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
         List <Getters> getters = new List <Getters>();
         foreach (PropertyInfo p in props)
         {
             GenericGetter g = CreateGetMethod(p);
             if (g != null)
             {
                 Getters gg = new Getters();
                 gg.Name   = p.Name;
                 gg.Getter = g;
                 getters.Add(gg);
             }
         }
         _getterscache.Add(type, getters);
         return(getters);
     }
 }
Esempio n. 3
0
 private Type GetTypeFromCache(string typename)
 {
     if (_typecache.ContainsKey(typename))
     {
         return(_typecache[typename]);
     }
     else
     {
         Type t = Type.GetType(typename);
         _typecache.Add(typename, t);
         return(t);
     }
 }
Esempio n. 4
0
 private GenericSetter GetSetter(PropertyInfo prop)
 {
     if (_settercache.ContainsKey(prop))
     {
         return(_settercache[prop]);
     }
     else
     {
         GenericSetter s = CreateSetMethod(prop);
         _settercache.Add(prop, s);
         return(s);
     }
 }