Beispiel #1
0
        /// <summary>
        ///  为一个类型获取元数据并加入元数据缓存集合
        /// </summary>
        /// <param name="t"></param>
        public static void AddProperty(this Type t)
        {
            if (!_MetadataStack.PropertyList.Keys.Contains(t.FullName))
            {
                lock (obj)
                {
                    List <PropertyInfo> ps = null;

                    ps = t.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty).ToList();

                    _MetadataStack.PropertyList[t.FullName] = ps;

                    foreach (PropertyInfo p in ps)
                    {
                        _MetadataStack.SetFastInvokeHandler(t.FullName + p.Name + "set", p.SetMethod);
                        _MetadataStack.SetFastInvokeHandler(t.FullName + p.Name + "get", p.GetMethod);
                        p.AddAttribute();
                    }
                    t.AddAttribute();
                }
            }
        }