PageRenderTime 264ms CodeModel.GetById 141ms app.highlight 2ms RepoModel.GetById 118ms app.codeStats 0ms

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