示例#1
0
        /// <summary>
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        protected DbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource)
        {
            if (dataSource == null)
            {
                throw new ArgumentNullException(nameof(dataSource), $"{nameof(dataSource)} is null.");
            }

            m_DataSource = dataSource;
            StrictMode   = dataSource.StrictMode;
        }
示例#2
0
    /// <summary>
    /// Initializes a new instance of the <see cref="DeleteSetDbCommandBuilder{TCommand, TParameter}" /> class.
    /// </summary>
    /// <param name="dataSource">The data source.</param>
    /// <param name="whereClause">The where clause.</param>
    /// <param name="parameters">The parameters.</param>
    /// <param name="expectedRowCount">The expected row count.</param>
    /// <param name="options">The options.</param>
    public DeleteSetDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource, string whereClause, IEnumerable <TParameter> parameters, int?expectedRowCount, DeleteOptions options) : base(dataSource)
    {
        if (options.HasFlag(DeleteOptions.UseKeyAttribute))
        {
            throw new NotSupportedException("Cannot use Key attributes with this operation.");
        }

        WhereClause      = whereClause;
        Parameters       = parameters;
        Options          = options;
        ExpectedRowCount = expectedRowCount;
    }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandExecutionToken{TCommand, TParameter}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="operationName">Name of the operation. This is used for logging.</param>
 /// <param name="commandText">The SQL to be executed.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="commandType">Type of the command.</param>
 public SqlServerCommandExecutionToken(ICommandDataSource <SqlCommand, SqlParameter> dataSource, string operationName, string commandText, IReadOnlyList <SqlParameter> parameters, CommandType commandType = CommandType.Text)
     : base(dataSource, operationName, commandText, parameters, commandType)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandExecutionToken{TCommand, TParameter}" /> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="operationName">Name of the operation. This is used for logging.</param>
 /// <param name="commandText">The SQL to be executed.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="commandType">Type of the command.</param>
 /// <param name="lockType">Type of the lock.</param>
 public SQLiteCommandExecutionToken(ICommandDataSource <SQLiteCommand, SQLiteParameter> dataSource, string operationName, string commandText, IReadOnlyList <SQLiteParameter> parameters, CommandType commandType = CommandType.Text, LockType lockType = LockType.Write)
     : base(dataSource, operationName, commandText, parameters, commandType)
 {
     LockType = lockType;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectDbCommandBuilder{TCommand, TParameter, TArgument}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="argumentValue">The argument value.</param>
 protected ObjectDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource, TArgument argumentValue) : base(dataSource)
 {
     ArgumentValue = argumentValue;
 }
 /// <summary>Initializes a new instance of the <see cref="Tortuga.Chain.CommandBuilders.UpdateManyDbCommandBuilder{TCommand, TParameter}"/> class.</summary>
 /// <param name="dataSource">The data source.</param>
 protected UpdateManyDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource)
     : base(dataSource)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandExecutionToken{TCommand, TParameter}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="operationName">Name of the operation. This is used for logging.</param>
 /// <param name="commandText">The SQL to be executed.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="commandType">Type of the command.</param>
 public CommandExecutionToken(ICommandDataSource <TCommand, TParameter> dataSource, string operationName, string commandText, IReadOnlyList <TParameter> parameters, CommandType commandType = CommandType.Text)
     : base(dataSource, operationName, commandText, commandType)
 {
     m_DataSource = dataSource;
     Parameters   = parameters;
 }
示例#8
0
 /// <summary>Initializes a new instance of the <see cref="Tortuga.Chain.CommandBuilders.ProcedureDbCommandBuilder{TCommand, TParameter}"/> class.</summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="argumentValue">The argument value.</param>
 protected ProcedureDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource, object?argumentValue)
     : base(dataSource)
 {
     ArgumentValue = argumentValue;
 }
示例#9
0
 /// <summary>
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 protected MultipleRowDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource) : base(dataSource)
 {
 }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericDbSqlCall"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="sqlStatement">The SQL statement.</param>
 /// <param name="argumentValue">The argument value.</param>
 /// <exception cref="ArgumentException">sqlStatement is null or empty.;sqlStatement</exception>
 public DbSqlCall(ICommandDataSource <TCommand, TParameter> dataSource, string sqlStatement, object?argumentValue) : base(dataSource)
 {
     SqlStatement  = sqlStatement;
     ArgumentValue = argumentValue;
 }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteSetDbCommandBuilder{TCommand, TParameter}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="filterValue">The filter value.</param>
 /// <param name="filterOptions">The options.</param>
 public DeleteSetDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource, object filterValue, FilterOptions filterOptions) : base(dataSource)
 {
     FilterValue   = filterValue;
     FilterOptions = filterOptions;
 }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteSetDbCommandBuilder{TCommand, TParameter}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="whereClause">The where clause.</param>
 /// <param name="argumentValue">The argument value.</param>
 public DeleteSetDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource, string whereClause, object?argumentValue) : base(dataSource)
 {
     WhereClause   = whereClause;
     ArgumentValue = argumentValue;
 }
示例#13
0
 public CommandService(ICommandDataSource dataSource)
 {
     _dataSource = dataSource;
 }
示例#14
0
 /// <summary>Initializes a new instance of the <see cref="Tortuga.Chain.CommandBuilders.ScalarDbCommandBuilder{TCommand, TParameter}"/> class.</summary>
 /// <param name="dataSource">The data source.</param>
 protected ScalarDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource)
     : base(dataSource)
 {
 }
示例#15
0
 /// <summary>Initializes a new instance of the <see cref="Tortuga.Chain.CommandBuilders.ProcedureDbCommandBuilder{TCommand, TParameter}"/> class.</summary>
 /// <param name="dataSource">The data source.</param>
 protected ProcedureDbCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource)
     : base(dataSource)
 {
 }
 protected OleDbSqlServerObjectCommand(ICommandDataSource <OleDbCommand, OleDbParameter> dataSource, TArgument argumentValue) : base(dataSource, argumentValue)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PostgreSqlCommandExecutionToken" /> class.
 /// </summary>
 public PostgreSqlCommandExecutionToken(ICommandDataSource <NpgsqlCommand, NpgsqlParameter> dataSource, string operationName, string commandText, IReadOnlyList <NpgsqlParameter> parameters, CommandType commandType = CommandType.Text, bool dereferenceCursors = false) : base(dataSource, operationName, commandText, parameters, commandType)
 {
     DereferenceCursors = dereferenceCursors;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OleDbCommandExecutionToken"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="operationName">Name of the operation. This is used for logging.</param>
 /// <param name="commandText">The SQL to be executed.</param>
 /// <param name="parameters">The parameters.</param>
 /// <param name="commandType">Type of the command.</param>
 public OleDbCommandExecutionToken(ICommandDataSource <OleDbCommand, OleDbParameter> dataSource, string operationName, string commandText, IReadOnlyList <OleDbParameter> parameters, CommandType commandType = CommandType.Text)
     : base(dataSource, operationName, commandText, parameters, commandType)
 {
 }
示例#19
0
 /// <summary>Initializes a new instance of the <see cref="ScalarFunctionCommandBuilder{TCommand, TParameter}"/> class.</summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="functionArgumentValue">The function argument.</param>
 protected ScalarFunctionCommandBuilder(ICommandDataSource <TCommand, TParameter> dataSource, object?functionArgumentValue) : base(dataSource)
 {
     FunctionArgumentValue = functionArgumentValue;
 }