예제 #1
0
 /// <summary>
 /// Execute parameterized SQL.
 /// </summary>
 /// <param name="db">The DB to execute on.</param>
 /// <param name="command">The command to execute on this connection.</param>
 /// <returns>The number of rows affected.</returns>
 public static int Execute(this Db db, CommandDefinition command) => SqlMapper.ExecuteImpl(db.Connection, ref command);
예제 #2
0
        /// <summary>
        /// Execute parameterized SQL.
        /// </summary>
        /// <param name="db">The DB to execute on.</param>
        /// <param name="sql">The SQL to execute for this query.</param>
        /// <param name="param">The parameters to use for this query.</param>
        /// <param name="commandTimeout">Number of seconds before command execution timeout.</param>
        /// <param name="commandType">Is it a stored proc or a batch?</param>
        /// <returns>The number of rows affected.</returns>
        public static int Execute(this Db db, string sql, object param = null, int?commandTimeout = null, CommandType?commandType = null)
        {
            var command = new CommandDefinition(sql, param, db.Transaction, commandTimeout, commandType, CommandFlags.Buffered);

            return(SqlMapper.ExecuteImpl(db.Connection, ref command));
        }