using System; using System.Runtime.InteropServices; namespace DeviceRepair.Models.Attr { /// /// DOM转换通用字段映射特性 20230327 /// (以前都是手动去匹配,这里加强下) /// [Serializable] [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ComVisible(true)] public sealed class DomFieldMapAttribute : Attribute { #region Fields /// /// 映射字段名称 /// private string _mappedFieldName; /// /// 映射字段顺序 /// private int _mappedFieldSequence; #endregion #region Ctor //构造函数,构造函数的参数在特性中也称为“位置参数”。 /// /// DOM转换通用字段映射特性 /// public DomFieldMapAttribute() : this("", 0) { } /// /// DOM转换通用字段映射特性 /// /// 映射的字段名称 /// 映射的字段顺序 public DomFieldMapAttribute(string cMappedName, int iMappedSequence) { _mappedFieldName = cMappedName; _mappedFieldSequence = iMappedSequence; } #endregion #region Property /// /// 映射字段名称 /// public string MappedFieldName { get { return _mappedFieldName; } set { _mappedFieldName = value; } } /// /// 映射字段顺序 /// public int MappedFieldSequence { get { return _mappedFieldSequence; } set { _mappedFieldSequence = value; } } #endregion } }