You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Apewer.Source
  5. {
  6. /// <summary>用于执行 SQL 语句的参数。</summary>
  7. [Serializable]
  8. public class Parameter
  9. {
  10. private string _name;
  11. /// <summary>名称,不可设置位为空。</summary>
  12. /// <exception cref="ArgumentException"></exception>
  13. /// <exception cref="ArgumentNullException"></exception>
  14. public string Name
  15. {
  16. get
  17. {
  18. return _name;
  19. }
  20. set
  21. {
  22. if (value == null) throw new ArgumentNullException();
  23. if (value == "") throw new ArgumentException();
  24. _name = value;
  25. }
  26. }
  27. /// <summary>值。</summary>
  28. public object Value { get; set; }
  29. /// <summary>类型。</summary>
  30. public ColumnType Type { get; set; }
  31. /// <summary>类型为 VarChar 时,可指定长度。</summary>
  32. public int Size { get; set; }
  33. /// <summary>创建用于执行 SQL 语句的参数,名称不可设置位为空。</summary>
  34. /// <exception cref="ArgumentException"></exception>
  35. /// <exception cref="ArgumentNullException"></exception>
  36. public Parameter(string name, object value, ColumnType type, int size = 0)
  37. {
  38. Name = name;
  39. Value = value;
  40. Type = type;
  41. Size = size;
  42. }
  43. }
  44. }