Table of Contents

Interface IWhereEntityBuilder<TEntity, TBuilder>

Namespace
FluentCommand.Query
Assembly
FluentCommand.dll

Defines methods for building SQL WHERE clauses for a specific entity type with fluent, chainable methods.

public interface IWhereEntityBuilder<TEntity, out TBuilder> where TEntity : class

Type Parameters

TEntity

The type of the entity.

TBuilder

The type of the builder returned for chaining.

Methods

WhereAnd(Action<LogicalEntityBuilder<TEntity>>)

Adds a logical AND group to the WHERE clause using the specified builder action.

TBuilder WhereAnd(Action<LogicalEntityBuilder<TEntity>> builder)

Parameters

builder Action<LogicalEntityBuilder<TEntity>>

An action that configures the logical AND group using a LogicalEntityBuilder<TEntity>.

Returns

TBuilder

The builder instance for chaining further calls.

WhereIf<TValue>(Expression<Func<TEntity, TValue>>, TValue, FilterOperators, Func<string, TValue, bool>)

Conditionally adds a WHERE clause for the specified property, value, and filter operator.

TBuilder WhereIf<TValue>(Expression<Func<TEntity, TValue>> property, TValue parameterValue, FilterOperators filterOperator = FilterOperators.Equal, Func<string, TValue, bool> condition = null)

Parameters

property Expression<Func<TEntity, TValue>>

An expression selecting the property to filter on.

parameterValue TValue

The value to compare the property against.

filterOperator FilterOperators

The filter operator to use (default is Equal).

condition Func<string, TValue, bool>

A function that determines whether to add the clause, based on the property name and value. If null, the clause is always added.

Returns

TBuilder

The builder instance for chaining further calls.

Type Parameters

TValue

The type of the value to compare.

WhereIf<TValue>(Expression<Func<TEntity, TValue>>, TValue, string, FilterOperators, Func<string, TValue, bool>)

Conditionally adds a WHERE clause for the specified property, value, filter operator, and table alias.

TBuilder WhereIf<TValue>(Expression<Func<TEntity, TValue>> property, TValue parameterValue, string tableAlias, FilterOperators filterOperator = FilterOperators.Equal, Func<string, TValue, bool> condition = null)

Parameters

property Expression<Func<TEntity, TValue>>

An expression selecting the property to filter on.

parameterValue TValue

The value to compare the property against.

tableAlias string

The table alias to use in the query.

filterOperator FilterOperators

The filter operator to use (default is Equal).

condition Func<string, TValue, bool>

A function that determines whether to add the clause, based on the table alias and value. If null, the clause is always added.

Returns

TBuilder

The builder instance for chaining further calls.

Type Parameters

TValue

The type of the value to compare.

WhereInIf<TValue>(Expression<Func<TEntity, TValue>>, IEnumerable<TValue>, Func<string, IEnumerable<TValue>, bool>)

Conditionally adds a WHERE IN clause for the specified property and collection of values.

TBuilder WhereInIf<TValue>(Expression<Func<TEntity, TValue>> property, IEnumerable<TValue> parameterValues, Func<string, IEnumerable<TValue>, bool> condition = null)

Parameters

property Expression<Func<TEntity, TValue>>

An expression selecting the property to filter on.

parameterValues IEnumerable<TValue>

The collection of values for the IN clause.

condition Func<string, IEnumerable<TValue>, bool>

A function that determines whether to add the clause, based on the property name and values. If null, the clause is always added.

Returns

TBuilder

The builder instance for chaining further calls.

Type Parameters

TValue

The type of the values to compare.

WhereInIf<TValue>(Expression<Func<TEntity, TValue>>, IEnumerable<TValue>, string, Func<string, IEnumerable<TValue>, bool>)

Conditionally adds a WHERE IN clause for the specified property, collection of values, and table alias.

TBuilder WhereInIf<TValue>(Expression<Func<TEntity, TValue>> property, IEnumerable<TValue> parameterValues, string tableAlias, Func<string, IEnumerable<TValue>, bool> condition = null)

Parameters

property Expression<Func<TEntity, TValue>>

An expression selecting the property to filter on.

parameterValues IEnumerable<TValue>

The collection of values for the IN clause.

tableAlias string

The table alias to use in the query.

condition Func<string, IEnumerable<TValue>, bool>

A function that determines whether to add the clause, based on the table alias and values. If null, the clause is always added.

Returns

TBuilder

The builder instance for chaining further calls.

Type Parameters

TValue

The type of the values to compare.

WhereIn<TValue>(Expression<Func<TEntity, TValue>>, IEnumerable<TValue>, string)

Adds a WHERE IN clause for the specified property and collection of values, with an optional table alias.

TBuilder WhereIn<TValue>(Expression<Func<TEntity, TValue>> property, IEnumerable<TValue> parameterValues, string tableAlias = null)

Parameters

property Expression<Func<TEntity, TValue>>

An expression selecting the property to filter on.

parameterValues IEnumerable<TValue>

The collection of values for the IN clause.

tableAlias string

The table alias to use in the query (optional).

Returns

TBuilder

The builder instance for chaining further calls.

Type Parameters

TValue

The type of the values to compare.

WhereOr(Action<LogicalEntityBuilder<TEntity>>)

Adds a logical OR group to the WHERE clause using the specified builder action.

TBuilder WhereOr(Action<LogicalEntityBuilder<TEntity>> builder)

Parameters

builder Action<LogicalEntityBuilder<TEntity>>

An action that configures the logical OR group using a LogicalEntityBuilder<TEntity>.

Returns

TBuilder

The builder instance for chaining further calls.

Where<TValue>(Expression<Func<TEntity, TValue>>, TValue, FilterOperators)

Adds a WHERE clause for the specified property, value, and filter operator.

TBuilder Where<TValue>(Expression<Func<TEntity, TValue>> property, TValue parameterValue, FilterOperators filterOperator = FilterOperators.Equal)

Parameters

property Expression<Func<TEntity, TValue>>

An expression selecting the property to filter on.

parameterValue TValue

The value to compare the property against.

filterOperator FilterOperators

The filter operator to use (default is Equal).

Returns

TBuilder

The builder instance for chaining further calls.

Type Parameters

TValue

The type of the value to compare.

Where<TValue>(Expression<Func<TEntity, TValue>>, TValue, string, FilterOperators)

Adds a WHERE clause for the specified property, value, filter operator, and table alias.

TBuilder Where<TValue>(Expression<Func<TEntity, TValue>> property, TValue parameterValue, string tableAlias, FilterOperators filterOperator = FilterOperators.Equal)

Parameters

property Expression<Func<TEntity, TValue>>

An expression selecting the property to filter on.

parameterValue TValue

The value to compare the property against.

tableAlias string

The table alias to use in the query.

filterOperator FilterOperators

The filter operator to use (default is Equal).

Returns

TBuilder

The builder instance for chaining further calls.

Type Parameters

TValue

The type of the value to compare.