using System; using System.Collections.Generic; using System.Text; using System.Data.Common; namespace ScrewTurn.Wiki.Plugins.SqlCommon { /// /// Defines an interface for a command builder component. /// /// Classes implementing this interface should be thread-safe. public interface ICommandBuilder { /// /// Gets the table and column name prefix. /// string ObjectNamePrefix { get; } /// /// Gets the table and column name suffix. /// string ObjectNameSuffix { get; } /// /// Gets the parameter name prefix. /// string ParameterNamePrefix { get; } /// /// Gets the parameter name suffix. /// string ParameterNameSuffix { get; } /// /// Gets the parameter name placeholder. /// string ParameterPlaceholder { get; } /// /// Gets a value indicating whether to use named parameters. If false, /// parameter placeholders will be equal to . /// bool UseNamedParameters { get; } /// /// Gets the string to use in order to separate queries in a batch. /// string BatchQuerySeparator { get; } /// /// Gets a new database connection, open. /// /// The connection string. /// The connection. DbConnection GetConnection(string connString); /// /// Gets a properly built database command, with the underlying connection already open. /// /// The connection string. /// The prepared query. /// The parameters, if any. /// The command. DbCommand GetCommand(string connString, string preparedQuery, List parameters); /// /// Gets a properly built database command, re-using an open connection. /// /// The open connection to use. /// The prepared query. /// The parameters, if any. /// The command. DbCommand GetCommand(DbConnection connection, string preparedQuery, List parameters); /// /// Gets a properly built database command, re-using an open connection and a begun transaction. /// /// The transaction. /// The prepared query. /// The parameters, if any. /// The command. DbCommand GetCommand(DbTransaction transaction, string preparedQuery, List parameters); } }