DataLengthAttribute.cs 856 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Core.Mes.Client.Comm.Attribute
  6. {
  7. /// <summary>
  8. /// 用来标识实体类的属性最大长度
  9. /// </summary>
  10. [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
  11. public class DataLengthAttribute : System.Attribute
  12. {
  13. private int _dataLength = 1;
  14. /// <summary>
  15. /// 字段长度
  16. /// </summary>
  17. public int DataLength
  18. {
  19. get { return _dataLength; }
  20. set { _dataLength = value; }
  21. }
  22. /// <summary>
  23. /// 字段长度特性构造函数
  24. /// </summary>
  25. /// <param name="nullable">字段长度</param>
  26. public DataLengthAttribute(int dataLength)
  27. {
  28. _dataLength = dataLength;
  29. }
  30. }
  31. }