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.

78 lines
2.1 KiB

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