Пример #1
0
 /// <summary>
 /// Converts the specified <see cref="SqlDelete"/> expression tree to an <see cref="IDbCommand"/>
 /// instance for the specified <paramref name="connection" />.
 /// </summary>
 /// <param name="sql">
 /// The <see cref="SqlDelete"/> to convert to an <see cref="IDbCommand"/>.
 /// </param>
 /// <param name="connection">
 /// The <see cref="IDbConnection"/> for which to create an <see cref="IDbCommand"/>.
 /// </param>
 /// <returns>
 /// An <see cref="IDbCommand"/> for the specified <paramref name="connection"/> that reprents
 /// the specified SQL expression tree.
 /// </returns>
 /// <remarks>
 /// Any <see cref="SqlParameter"/> members of the <see cref="SqlDelete"/> expression are
 /// automatically converted to <see cref="IDbDataParameter"/> instances and attached to
 /// the returned <see cref="IDbCommand"/>.
 /// </remarks>
 public static IDbCommand CreateCommand(this IDbConnection connection, SqlDelete sql)
 {
     return(connection.CreateCommandInternal(sql));
 }
Пример #2
0
 /// <summary>
 /// Converts the specified <see cref="SqlDelete"/> expression tree to SQL text.
 /// </summary>
 /// <param name="sql">
 /// The <see cref="SqlDelete"/> to convert to SQL text.
 /// </param>
 /// <param name="dialect">
 /// The <see cref="SqlDialect"/> used to format the SQL text.
 /// </param>
 /// <param name="parameterCallback">
 /// A delegate that is called when a SQL parameter is encountered while converting the SQL expression.
 /// </param>
 /// <returns>
 /// The SQL text for the specified SQL expression tree.
 /// </returns>
 public static string ToSql(this SqlDelete sql, SqlDialect dialect, Action <SqlParameter> parameterCallback)
 {
     return(sql.ToSqlInternal(dialect, parameterCallback));
 }
Пример #3
0
 public override void Visit(SqlDelete expression)
 {
     _writer.WriteKeyword(SqlKeywords.Delete);
 }
Пример #4
0
 /// <summary>
 /// Converts the specified <see cref="SqlDelete"/> expression tree to SQL text.
 /// </summary>
 /// <param name="sql">
 /// The <see cref="SqlDelete"/> to convert to SQL text.
 /// </param>
 /// <param name="dialect">
 /// The <see cref="SqlDialect"/> used to format the SQL text.
 /// </param>
 /// <returns>
 /// The SQL text for the specified SQL expression tree.
 /// </returns>
 public static string ToSql(this SqlDelete sql, SqlDialect dialect)
 {
     return(sql.ToSqlInternal(dialect));
 }
Пример #5
0
 /// <summary>
 /// Converts the specified <see cref="SqlDelete"/> expression tree to SQL text.
 /// </summary>
 /// <param name="sql">
 /// The <see cref="SqlDelete"/> to convert to SQL text.
 /// </param>
 /// <param name="parameterCallback">
 /// A delegate that is called when a SQL parameter is encountered while converting the SQL expression.
 /// </param>
 /// <returns>
 /// The SQL text for the specified SQL expression tree.
 /// </returns>
 public static string ToSql(this SqlDelete sql, Action <SqlParameter> parameterCallback)
 {
     return(sql.ToSql(null, parameterCallback));
 }
Пример #6
0
 /// <summary>
 /// Converts the specified <see cref="SqlDelete"/> expression tree to SQL text.
 /// </summary>
 /// <param name="sql">
 /// The <see cref="SqlDelete"/> to convert to SQL text.
 /// </param>
 /// <returns>
 /// The SQL text for the specified SQL expression tree.
 /// </returns>
 public static string ToSql(this SqlDelete sql)
 {
     return(sql.ToSql(null, null));
 }
            protected override SqlExpression VisitDelete(SqlDelete expression)
            {
                _writer.WriteStartDelete();
                _writer.WriteStartFrom();
                _writer.WriteTable(expression.Table.TableName, expression.Table.Alias);

                if (expression.Predicate != null)
                {
                    _writer.WriteStartWhere();
                    Visit(expression.Predicate);
                }

                return expression;
            }
 /// <summary>
 /// Converts the specified <see cref="SqlDelete"/> expression tree to an <see cref="IDbCommand"/>
 /// instance for the specified <paramref name="connection" />.
 /// </summary>
 /// <param name="sql">
 /// The <see cref="SqlDelete"/> to convert to an <see cref="IDbCommand"/>.
 /// </param>
 /// <param name="connection">
 /// The <see cref="IDbConnection"/> for which to create an <see cref="IDbCommand"/>.
 /// </param>
 /// <returns>
 /// An <see cref="IDbCommand"/> for the specified <paramref name="connection"/> that reprents
 /// the specified SQL expression tree.
 /// </returns>
 /// <remarks>
 /// Any <see cref="SqlParameter"/> members of the <see cref="SqlDelete"/> expression are
 /// automatically converted to <see cref="IDbDataParameter"/> instances and attached to
 /// the returned <see cref="IDbCommand"/>.
 /// </remarks>
 public static IDbCommand CreateCommand(this IDbConnection connection, SqlDelete sql)
 {
     return connection.CreateCommandInternal(sql);
 }