悲剧呀,</summary>后面多了一个尖括号……
nnhy authored at 2012-03-30 11:00:56
4.02 KiB
X
using System;
using System.Reflection;

namespace XCode
{
    /// <summary>Ö¸¶¨ÊµÌåÀàÊôÐÔËù°ó¶¨Êý¾Ý×Ö¶ÎÐÅÏ¢¡£</summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public sealed class BindColumnAttribute : Attribute
    {
        #region ÊôÐÔ
        private Int32 _Order;
        /// <summary>˳Ðò</summary>
        public Int32 Order
        {
            get { return _Order; }
            set { _Order = value; }
        }

        private String _Name;
        /// <summary>×Ö¶ÎÃû</summary>
        public String Name
        {
            get { return _Name; }
            set { _Name = value; }
        }

        private String _Description;
        /// <summary>ÃèÊö</summary>
        public String Description
        {
            get { return _Description; }
            set { _Description = value; }
        }

        private String _DefaultValue;
        /// <summary>ĬÈÏÖµ</summary>
        public String DefaultValue
        {
            get { return _DefaultValue; }
            set { _DefaultValue = value; }
        }

        private String _RawType;
        /// <summary>
        /// ԭʼÊý¾ÝÀàÐÍ¡£
        /// µ±ÇÒ½öµ±Ä¿±êÊý¾Ý¿âͬΪ¸ÃÊý¾Ý¿âÀàÐÍʱ£¬²ÉÓÃʵÌåÊôÐÔÐÅÏ¢ÉϵÄRawType×÷Ϊ·´Ïò¹¤³ÌµÄÄ¿±ê×Ö¶ÎÀàÐÍ£¬ÒÔÆÚ»ñµÃ¿ª·¢ºÍÉú²úµÄ×î¼Ñ¼æÈÝ¡£
        /// </summary>
        public String RawType
        {
            get { return _RawType; }
            set { _RawType = value; }
        }

        private Int32 _Precision;
        /// <summary>¾«¶È</summary>
        public Int32 Precision
        {
            get { return _Precision; }
            set { _Precision = value; }
        }

        private Int32 _Scale;
        /// <summary>λÊý</summary>
        public Int32 Scale
        {
            get { return _Scale; }
            set { _Scale = value; }
        }

        private Boolean _IsUnicode;
        /// <summary>ÊÇ·ñUnicode</summary>
        public Boolean IsUnicode
        {
            get { return _IsUnicode; }
            set { _IsUnicode = value; }
        }
        #endregion

        #region ¹¹Ôì
        /// <summary>¹¹Ô캯Êý</summary>
        public BindColumnAttribute() { }

        /// <summary>¹¹Ô캯Êý</summary>
        /// <param name="name">×Ö¶ÎÃû</param>
        public BindColumnAttribute(String name)
        {
            Name = name;
        }

        /// <summary>¹¹Ô캯Êý</summary>
        /// <param name="order"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="defaultValue"></param>
        public BindColumnAttribute(Int32 order, String name, String description, String defaultValue)
        {
            Order = order;
            Name = name;
            Description = description;
            DefaultValue = defaultValue;
        }

        /// <summary>¹¹Ô캯Êý</summary>
        /// <param name="order"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <param name="defaultValue"></param>
        /// <param name="rawType"></param>
        /// <param name="precision"></param>
        /// <param name="scale"></param>
        /// <param name="isUnicode"></param>
        public BindColumnAttribute(Int32 order, String name, String description, String defaultValue, String rawType, Int32 precision, Int32 scale, Boolean isUnicode)
            : this(order, name, description, defaultValue)
        {
            RawType = rawType;
            Precision = precision;
            Scale = scale;
            IsUnicode = isUnicode;
        }
        #endregion

        #region ·½·¨
        /// <summary>¼ìË÷Ó¦ÓÃÓÚÀàÐͳÉÔ±µÄ×Ô¶¨ÒåÊôÐÔ¡£</summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static BindColumnAttribute GetCustomAttribute(MemberInfo element)
        {
            return GetCustomAttribute(element, typeof(BindColumnAttribute)) as BindColumnAttribute;
        }
        #endregion
    }
}