Пример #1
0
        public static T Get <T>(string key)
        {
            T result = default(T);

            object temp = DbCache.Get(key);

            if (temp != null)
            {
                result = temp.Convert <T>();
            }

            return(result);
        }
Пример #2
0
        public static T GetModel <T>(this DbDataReader target) where T : class, new()
        {
            string typeFullName = typeof(T).FullName;

            PropertyInfo[] propertyList = DbCache.Get <PropertyInfo[]>(typeFullName);

            if (propertyList == null)
            {
                propertyList = typeof(T).GetProperties();

                DbCache.Set(typeFullName, propertyList);
            }

            return(target.GetModel <T>(propertyList));
        }