using System;
using System.Runtime.InteropServices;

namespace DeviceRepair.Models.Attr
{
    /// <summary>
    /// 单据业务对象字段是否转DOM时需要忽略特性
    /// （默认忽略）
    /// </summary>
    [Serializable]
    [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)]
    [ComVisible(true)]
    public sealed class DomFieldIgnoreAttribute
        : Attribute
    {
        #region Fields

        /// <summary>
        /// 在DOM时是否忽略该字段
        /// 默认true
        /// </summary>
        private bool ignore;

        #endregion

        #region Ctor
        //构造函数，构造函数的参数在特性中也称为“位置参数”。

        /// <summary>
        /// Ctor
        /// </summary>
        public DomFieldIgnoreAttribute()
            : this(true)
        {
        }
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="_ignore">构建DOM时是否忽略</param>
        public DomFieldIgnoreAttribute(bool _ignore)
        {
            ignore = _ignore;
        }
        #endregion

        #region Property
        /// <summary>
        /// 在DOM时是否忽略该字段
        /// 默认true
        /// </summary>
        public bool Ignored
        {
            get { return ignore; }
            set { ignore = value; }
        }
        #endregion
    }
}
