纽威
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.

72 lines
2.2 KiB

1 year ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data.SqlClient;
  5. namespace NFine.Data
  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. }