Class TemporalBuilder
- Namespace
- FluentCommand.Query
- Assembly
- FluentCommand.SqlServer.dll
Provides a builder for constructing SQL Server temporal table queries using FOR SYSTEM_TIME
clauses.
public class TemporalBuilder : StatementBuilder<TemporalBuilder>, IStatementBuilder, IQueryBuilder
- Inheritance
-
TemporalBuilder
- Implements
- Inherited Members
Constructors
TemporalBuilder(IQueryGenerator, List<QueryParameter>)
Initializes a new instance of the TemporalBuilder class.
public TemporalBuilder(IQueryGenerator queryGenerator, List<QueryParameter> parameters)
Parameters
queryGenerator
IQueryGeneratorThe query generator used to build SQL expressions.
parameters
List<QueryParameter>The list of query parameters.
Methods
All()
Configures the query to return all rows from the temporal table's history using FOR SYSTEM_TIME ALL
.
public TemporalBuilder All()
Returns
- TemporalBuilder
The same TemporalBuilder instance for fluent chaining.
AsOf(DateTime)
Configures the query to return rows as of a specific point in time using FOR SYSTEM_TIME AS OF
.
public TemporalBuilder AsOf(DateTime utcPointInTime)
Parameters
utcPointInTime
DateTimeThe UTC date and time to query as of.
Returns
- TemporalBuilder
The same TemporalBuilder instance for fluent chaining.
Between(DateTime, DateTime)
Configures the query to return rows that were active between two points in time using FOR SYSTEM_TIME BETWEEN
.
public TemporalBuilder Between(DateTime utcStart, DateTime utcEnd)
Parameters
Returns
- TemporalBuilder
The same TemporalBuilder instance for fluent chaining.
BuildStatement()
Builds the SQL statement for the temporal query using the specified table and temporal clause.
public override QueryStatement BuildStatement()
Returns
- QueryStatement
A QueryStatement representing the constructed temporal query and its parameters.
ContainedIn(DateTime, DateTime)
Configures the query to return rows whose period is contained within the specified range using FOR SYSTEM_TIME CONTAINED IN
.
public TemporalBuilder ContainedIn(DateTime utcStart, DateTime utcEnd)
Parameters
Returns
- TemporalBuilder
The same TemporalBuilder instance for fluent chaining.
From(string, string, string)
Specifies the source table for the temporal query using the table name, schema, and optional alias.
public TemporalBuilder From(string tableName, string tableSchema = null, string tableAlias = null)
Parameters
tableName
stringThe name of the table to query.
tableSchema
stringThe schema of the table (optional).
tableAlias
stringThe alias to use for the table in the query (optional).
Returns
- TemporalBuilder
The same TemporalBuilder instance for fluent chaining.
FromTo(DateTime, DateTime)
Configures the query to return rows that were active from the start time to the end time using FOR SYSTEM_TIME FROM ... AND ...
.
public TemporalBuilder FromTo(DateTime utcStart, DateTime utcEnd)
Parameters
Returns
- TemporalBuilder
The same TemporalBuilder instance for fluent chaining.
From<TEntity>(string)
Specifies the source table for the temporal query using the entity type and optional alias.
public TemporalBuilder From<TEntity>(string tableAlias = null)
Parameters
tableAlias
stringThe alias to use for the table in the query (optional).
Returns
- TemporalBuilder
The same TemporalBuilder instance for fluent chaining.
Type Parameters
TEntity
The entity type representing the table.