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.

73 lines
2.2 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data.SqlClient;
  5. namespace DBUtility
  6. {
  7. public enum EffentNextType
  8. {
  9. /// <summary>
  10. /// 對其他語句无任何影響
  11. /// </summary>
  12. None,
  13. /// <summary>
  14. /// 當前語句必須为"select count(1) from .."格式,如果存在則繼續執行,不存在回滾事務
  15. /// </summary>
  16. WhenHaveContine,
  17. /// <summary>
  18. /// 當前語句必須为"select count(1) from .."格式,如果不存在則繼續執行,存在回滾事務
  19. /// </summary>
  20. WhenNoHaveContine,
  21. /// <summary>
  22. /// 當前語句影響到的行數必須大于0,否則回滾事務
  23. /// </summary>
  24. ExcuteEffectRows,
  25. /// <summary>
  26. /// 引發事件-當前語句必須为"select count(1) from .."格式,如果不存在則繼續執行,存在回滾事務
  27. /// </summary>
  28. SolicitationEvent
  29. }
  30. public class CommandInfo
  31. {
  32. public object ShareObject = null;
  33. public object OriginalData = null;
  34. event EventHandler _solicitationEvent;
  35. public event EventHandler SolicitationEvent
  36. {
  37. add
  38. {
  39. _solicitationEvent += value;
  40. }
  41. remove
  42. {
  43. _solicitationEvent -= value;
  44. }
  45. }
  46. public void OnSolicitationEvent()
  47. {
  48. if (_solicitationEvent != null)
  49. {
  50. _solicitationEvent(this, new EventArgs());
  51. }
  52. }
  53. public string CommandText;
  54. public System.Data.Common.DbParameter[] Parameters;
  55. public EffentNextType EffentNextType = EffentNextType.None;
  56. public CommandInfo()
  57. {
  58. }
  59. public CommandInfo(string sqlText, SqlParameter[] para)
  60. {
  61. this.CommandText = sqlText;
  62. this.Parameters = para;
  63. }
  64. public CommandInfo(string sqlText, SqlParameter[] para, EffentNextType type)
  65. {
  66. this.CommandText = sqlText;
  67. this.Parameters = para;
  68. this.EffentNextType = type;
  69. }
  70. }
  71. }