Table of Contents

Class StatementBuilder

Namespace
FluentCommand.Query
Assembly
FluentCommand.dll

Provides a builder for constructing raw SQL query statements and parameters.

public class StatementBuilder : StatementBuilder<StatementBuilder>, IStatementBuilder, IQueryBuilder
Inheritance
StatementBuilder
Implements
Inherited Members

Constructors

StatementBuilder(IQueryGenerator, List<QueryParameter>)

Initializes a new instance of the StatementBuilder class.

public StatementBuilder(IQueryGenerator queryGenerator, List<QueryParameter> parameters)

Parameters

queryGenerator IQueryGenerator

The IQueryGenerator used to generate SQL expressions and comments.

parameters List<QueryParameter>

The initial list of QueryParameter objects for the query.

Properties

Statement

Gets or sets the SQL query statement to be executed.

protected string Statement { get; set; }

Property Value

string

The SQL query statement as a string.

Methods

BuildStatement()

Builds and returns a QueryStatement representing the SQL query and its parameters.

public override QueryStatement BuildStatement()

Returns

QueryStatement

A QueryStatement containing the SQL statement and associated QueryParameter values.

Parameter<TValue>(string, TValue)

Adds a query parameter with the specified name and value to the builder.

public StatementBuilder Parameter<TValue>(string name, TValue value)

Parameters

name string

The name of the parameter.

value TValue

The value of the parameter.

Returns

StatementBuilder

The current StatementBuilder instance for method chaining.

Type Parameters

TValue

The type of the parameter value.

Query(string)

Sets the SQL query statement for this builder.

public StatementBuilder Query(string queryStatement)

Parameters

queryStatement string

The SQL query statement as a string.

Returns

StatementBuilder

The current StatementBuilder instance for method chaining.