ChildAttribute.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data;
  5. namespace Ant.ORM
  6. {
  7. /// <summary>
  8. /// 子对象特性
  9. /// </summary>
  10. [AttributeUsage(AttributeTargets.Property)]
  11. public class ChildAttribute : Attribute
  12. {
  13. private string _ChildTable;
  14. private string _maintable;
  15. private string[] _ChildTableFields;
  16. private DbType[] _DataType;
  17. private string _Key;
  18. private string[] _ParentTableFields;
  19. private string _ShowField;
  20. /// <summary>
  21. /// 子对象
  22. /// </summary>
  23. /// <param name="key">关键字</param>
  24. /// <param name="childTable">外键所在的表</param>
  25. /// <param name="parentTableFields">父表字段</param>
  26. /// <param name="childTableFields">子表字段名</param>
  27. /// <param name="dataType">数据类型</param>
  28. public ChildAttribute(string key, string maintable, string childTable, string[] parentTableFields, string[] childTableFields, DbType[] dataType, string showField)
  29. {
  30. this._Key = key;
  31. this._maintable = maintable;
  32. this._ChildTable = childTable;
  33. this._ParentTableFields = parentTableFields;
  34. this._ChildTableFields = childTableFields;
  35. this._DataType = dataType;
  36. this._ShowField = showField;
  37. }
  38. /// <summary>
  39. /// 外键所在的表
  40. /// </summary>
  41. public string ChildTable
  42. {
  43. get
  44. {
  45. return this._ChildTable;
  46. }
  47. }
  48. /// <summary>
  49. /// 外键所在的表
  50. /// </summary>
  51. public string MainTable
  52. {
  53. get
  54. {
  55. return this._maintable;
  56. }
  57. }
  58. /// <summary>
  59. /// 子表字段名
  60. /// </summary>
  61. public string[] ChildTableFields
  62. {
  63. get
  64. {
  65. return this._ChildTableFields;
  66. }
  67. }
  68. /// <summary>
  69. /// 数据类型
  70. /// </summary>
  71. public DbType[] DataType
  72. {
  73. get
  74. {
  75. return this._DataType;
  76. }
  77. }
  78. /// <summary>
  79. /// 关键字
  80. /// </summary>
  81. public string Key
  82. {
  83. get
  84. {
  85. return this._Key;
  86. }
  87. }
  88. /// <summary>
  89. /// 父表字段
  90. /// </summary>
  91. public string[] ParentTableFields
  92. {
  93. get
  94. {
  95. return this._ParentTableFields;
  96. }
  97. }
  98. /// <summary>
  99. /// 显示值的字段
  100. /// </summary>
  101. public string ShowField
  102. {
  103. get
  104. {
  105. return this._ShowField;
  106. }
  107. }
  108. }
  109. }