Class ChangeTableBuilder
- Namespace
- FluentCommand.Query
- Assembly
- FluentCommand.SqlServer.dll
Provides a builder for constructing SQL Server CHANGETABLE (CHANGES ...)
queries for change tracking.
public class ChangeTableBuilder : StatementBuilder<ChangeTableBuilder>, IStatementBuilder, IQueryBuilder
- Inheritance
-
ChangeTableBuilder
- Implements
- Inherited Members
Constructors
ChangeTableBuilder(IQueryGenerator, List<QueryParameter>)
Initializes a new instance of the ChangeTableBuilder class.
public ChangeTableBuilder(IQueryGenerator queryGenerator, List<QueryParameter> parameters)
Parameters
queryGenerator
IQueryGeneratorThe query generator used to build SQL expressions.
parameters
List<QueryParameter>The list of query parameters.
Methods
BuildStatement()
Builds the CHANGETABLE (CHANGES ...)
SQL statement using the specified table and version.
public override QueryStatement BuildStatement()
Returns
- QueryStatement
A QueryStatement representing the constructed
CHANGETABLE
query and its parameters.
From(string, string, string)
Specifies the source table for the CHANGETABLE
query using the table name, schema, and optional alias.
public ChangeTableBuilder From(string tableName, string tableSchema = null, string tableAlias = null)
Parameters
tableName
stringThe name of the table to track changes for.
tableSchema
stringThe schema of the table (optional).
tableAlias
stringThe alias to use for the table in the query (optional).
Returns
- ChangeTableBuilder
The same ChangeTableBuilder instance for fluent chaining.
From<TEntity>(string)
Specifies the source table for the CHANGETABLE
query using the entity type and optional alias.
public ChangeTableBuilder From<TEntity>(string tableAlias = null)
Parameters
tableAlias
stringThe alias to use for the table in the query (optional).
Returns
- ChangeTableBuilder
The same ChangeTableBuilder instance for fluent chaining.
Type Parameters
TEntity
The entity type representing the table.
LastVersion(long)
Sets the last version value for the CHANGETABLE
query, which is used to retrieve changes since the specified version.
public ChangeTableBuilder LastVersion(long lastVersion)
Parameters
lastVersion
longThe last version number to use for change tracking.
Returns
- ChangeTableBuilder
The same ChangeTableBuilder instance for fluent chaining.