MDataProperty.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Ant.ORM.Table
  5. {
  6. internal class MDataProperty : System.ComponentModel.PropertyDescriptor
  7. {
  8. private MDataCell cell = null;
  9. public MDataProperty(MDataCell mdc, Attribute[] attrs)
  10. : base(mdc._CellStruct.ColumnName, attrs)
  11. {
  12. cell = mdc;
  13. }
  14. public override bool CanResetValue(object component)
  15. {
  16. return false;
  17. }
  18. public override Type ComponentType
  19. {
  20. get
  21. {
  22. return typeof(MDataCell);
  23. }
  24. }
  25. public override object GetValue(object component)
  26. {
  27. return ((MDataRow)component)[cell._CellStruct.ColumnName].Value;
  28. }
  29. public override bool IsReadOnly
  30. {
  31. get
  32. {
  33. return false;
  34. }
  35. }
  36. public override Type PropertyType
  37. {
  38. get { return cell._CellStruct.ValueType; }
  39. }
  40. public override void ResetValue(object component)
  41. {
  42. }
  43. public override void SetValue(object component, object value)
  44. {
  45. cell.Value = value;
  46. }
  47. public override bool ShouldSerializeValue(object component)
  48. {
  49. return true;
  50. }
  51. //public override string Description
  52. //{
  53. // get
  54. // {
  55. // return cell._CellStruct.ColumnName;
  56. // }
  57. //}
  58. //public override string Category
  59. //{
  60. // get
  61. // {
  62. // return _customProperty.Category;
  63. // }
  64. //}
  65. //public override string DisplayName
  66. //{
  67. // get
  68. // {
  69. // return cell._CellStruct.ColumnName;
  70. // }
  71. //}
  72. public override bool IsBrowsable
  73. {
  74. get
  75. {
  76. return true;
  77. }
  78. }
  79. }
  80. }