/Rhino.Etl.Core/Operations/AbstractCommandOperation.cs

http://github.com/ayende/rhino-etl · C# · 48 lines · 21 code · 6 blank · 21 comment · 0 complexity · 76f472a5b7cfc2c3f95b946a28aea50b MD5 · raw file

  1. using System.Configuration;
  2. namespace Rhino.Etl.Core.Operations
  3. {
  4. using System.Data;
  5. /// <summary>
  6. /// Base class for operations that directly manipulate ADO.Net
  7. /// It is important to remember that this is supposed to be a deep base class, not to be
  8. /// directly inherited or used
  9. /// </summary>
  10. public abstract class AbstractCommandOperation : AbstractDatabaseOperation
  11. {
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="AbstractDatabaseOperation"/> class.
  14. /// </summary>
  15. /// <param name="connectionStringName">Name of the connection string.</param>
  16. protected AbstractCommandOperation(string connectionStringName)
  17. : this(ConfigurationManager.ConnectionStrings[connectionStringName])
  18. {
  19. }
  20. /// <summary>
  21. /// Initializes a new instance of the <see cref="AbstractDatabaseOperation"/> class.
  22. /// </summary>
  23. /// <param name="connectionStringSettings">The connection string settings to use.</param>
  24. protected AbstractCommandOperation(ConnectionStringSettings connectionStringSettings)
  25. : base(connectionStringSettings)
  26. {
  27. }
  28. /// <summary>
  29. /// The current command
  30. /// </summary>
  31. protected IDbCommand currentCommand;
  32. /// <summary>
  33. /// Adds the parameter to the current command
  34. /// </summary>
  35. /// <param name="name">The name.</param>
  36. /// <param name="value">The value.</param>
  37. protected void AddParameter(string name, object value)
  38. {
  39. AddParameter(currentCommand, name, value);
  40. }
  41. }
  42. }