Esempio n. 1
0
        /// <summary>
        /// 获取类型标记的配置属性
        /// </summary>
        /// <typeparam name="T">类型</typeparam>
        /// <returns></returns>
        protected virtual GenericConfigAttribute GetConfigAttribute <T>()
        {
            var attribute = AttributeCache.GetOrAdd(
                typeof(T), t => t.GetTypeInfo().GetAttribute <GenericConfigAttribute>());

            if (attribute == null)
            {
                throw new ArgumentException(string.Format(
                                                "type {0} not contains GenericConfigAttribute", typeof(T).Name));
            }
            return(attribute);
        }