Class JoinBuilder<TBuilder>
- Namespace
- FluentCommand.Query
- Assembly
- FluentCommand.dll
Provides a generic base class for building SQL JOIN clauses with fluent, chainable methods.
public class JoinBuilder<TBuilder> : StatementBuilder<TBuilder>, IStatementBuilder, IQueryBuilder where TBuilder : JoinBuilder<TBuilder>
Type Parameters
TBuilder
The type of the builder for fluent chaining.
- Inheritance
-
StatementBuilder<TBuilder>JoinBuilder<TBuilder>
- Implements
- Derived
- Inherited Members
Constructors
JoinBuilder(IQueryGenerator, List<QueryParameter>)
Initializes a new instance of the JoinBuilder<TBuilder> class.
public JoinBuilder(IQueryGenerator queryGenerator, List<QueryParameter> parameters)
Parameters
queryGenerator
IQueryGeneratorThe IQueryGenerator used to generate SQL expressions.
parameters
List<QueryParameter>The list of QueryParameter objects for the query.
Properties
JoinExpression
Gets or sets the join expression that defines the JOIN clause.
protected JoinExpression JoinExpression { get; set; }
Property Value
- JoinExpression
The JoinExpression representing the JOIN clause.
Methods
BuildExpression()
Builds and returns the JoinExpression representing the configured JOIN clause.
public virtual JoinExpression BuildExpression()
Returns
- JoinExpression
The JoinExpression for the JOIN clause.
BuildStatement()
Builds the SQL JOIN statement using the current configuration.
public override QueryStatement BuildStatement()
Returns
- QueryStatement
A QueryStatement containing the SQL JOIN clause and its parameters.
Left(string, string)
Specifies the left column to join on.
public TBuilder Left(string columnName, string tableAlias)
Parameters
columnName
stringThe name of the column in the left table.
tableAlias
stringThe alias of the left table.
Returns
- TBuilder
The same builder instance for method chaining.
Right(string, string, string, string)
Specifies the right column and table to join on.
public TBuilder Right(string columnName, string tableName, string tableSchema, string tableAlias)
Parameters
columnName
stringThe name of the column in the right table.
tableName
stringThe name of the right table.
tableSchema
stringThe schema of the right table.
tableAlias
stringThe alias of the right table. If
null
, the table name is used as the alias.
Returns
- TBuilder
The same builder instance for method chaining.
Type(JoinTypes)
Specifies the type of SQL JOIN operation to use.
public TBuilder Type(JoinTypes joinType)
Parameters
Returns
- TBuilder
The same builder instance for method chaining.