SQLHelperRequestData.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace HPSocketCS.Extended
  6. {
  7. /// <summary>
  8. /// SQL请求数据处理类
  9. /// </summary>
  10. [Serializable]
  11. public class SQLHelperRequestData
  12. {
  13. public SQLHelperRequestData(){
  14. }
  15. public SQLHelperRequestData(HPSocketCS.Extended.SQLHelperRequestType rType)
  16. {
  17. this.RequestType = (int)rType;
  18. }
  19. private Int32 _RequestType;
  20. /// <summary>
  21. /// 数据请求类型
  22. /// </summary>
  23. public Int32 RequestType
  24. {
  25. get { return _RequestType; }
  26. set { _RequestType = value; }
  27. }
  28. List<SerSqlCommandItme> serSqlCommandList = new List<SerSqlCommandItme>();
  29. /// <summary>
  30. /// 请求命令集合
  31. /// </summary>
  32. public List<SerSqlCommandItme> SerSqlCommandList
  33. {
  34. get { return serSqlCommandList; }
  35. set { serSqlCommandList = value; }
  36. }
  37. /// <summary>
  38. /// 获取sql语句命令 如果SerSqlCommandList 集合中有多条命令时 取第一条
  39. /// </summary>
  40. public SerSqlCommandItme GetSerSqlCommand {
  41. get {
  42. if (serSqlCommandList.Count > 0)
  43. {
  44. return serSqlCommandList[0];
  45. }
  46. else {
  47. return new SerSqlCommandItme();
  48. }
  49. }
  50. }
  51. byte[] _AttachedData = null;
  52. /// <summary>
  53. /// 附加数据 暂无作用
  54. /// </summary>
  55. public byte[] AttachedData
  56. {
  57. get { return _AttachedData; }
  58. set { _AttachedData = value; }
  59. }
  60. string _AttachedMessage = "";
  61. /// <summary>
  62. /// 附加消息 暂无作用
  63. /// </summary>
  64. public string AttachedMessage
  65. {
  66. get { return _AttachedMessage; }
  67. set { _AttachedMessage = value; }
  68. }
  69. /// <summary>
  70. /// 将附加数据字节娄组转为对象
  71. /// </summary>
  72. /// <typeparam name="T"></typeparam>
  73. /// <returns></returns>
  74. public T AttachedDataToObject<T>()
  75. {
  76. try
  77. {
  78. return (T)HPSocketCS.Extended.DataSetSerializerDeserialize.ObjectDeserialize(this._AttachedData);
  79. }
  80. catch
  81. {
  82. return default(T);
  83. }
  84. }
  85. }
  86. }