Table of Contents

Class SqlStatementExpressionFactoryExtensions

Namespace
LfrlAnvil.Sql.Statements.Compilers
Assembly
LfrlAnvil.Sql.Core.dll

Contains various statement expression factory extension methods.

public static class SqlStatementExpressionFactoryExtensions
Inheritance
SqlStatementExpressionFactoryExtensions
Inherited Members

Methods

CreateAsyncExpressionForValue<T>(ISqlQueryReaderFactory, string, bool, SqlQueryReaderResultSetFieldsPersistenceMode)

Creates a new SqlAsyncQueryReaderExpression<TRow> instance for rows of Value<T> type.

[Pure]
public static SqlAsyncQueryReaderExpression<Value<T>> CreateAsyncExpressionForValue<T>(this ISqlQueryReaderFactory factory, string fieldName, bool alwaysTestForNull = false, SqlQueryReaderResultSetFieldsPersistenceMode resultSetFieldsPersistenceMode = SqlQueryReaderResultSetFieldsPersistenceMode.Ignore)

Parameters

factory ISqlQueryReaderFactory

Source factory.

fieldName string

Name of the SQL field to read as row's value.

alwaysTestForNull bool

Specifies whether fieldName values should be tested for null. Equal to false by default.

resultSetFieldsPersistenceMode SqlQueryReaderResultSetFieldsPersistenceMode

Specifies how query result set fields should be extracted, if at all. Equal to Ignore by default.

Returns

SqlAsyncQueryReaderExpression<Value<T>>

New SqlAsyncQueryReaderExpression<TRow> instance.

Type Parameters

T

Row's value type.

CreateAsyncExpression<TRow>(ISqlQueryReaderFactory, SqlQueryReaderCreationOptions?)

Creates a new SqlAsyncQueryReaderExpression<TRow> instance.

[Pure]
public static SqlAsyncQueryReaderExpression<TRow> CreateAsyncExpression<TRow>(this ISqlQueryReaderFactory factory, SqlQueryReaderCreationOptions? options = null) where TRow : notnull

Parameters

factory ISqlQueryReaderFactory

Source factory.

options SqlQueryReaderCreationOptions?

Optional SqlQueryReaderCreationOptions.

Returns

SqlAsyncQueryReaderExpression<TRow>

New SqlAsyncQueryReaderExpression<TRow> instance.

Type Parameters

TRow

Row type.

Exceptions

SqlCompilerException

When TRow is not a valid row type or does not contain a valid constructor or does not contain any valid members or this factory does not support asynchronous expressions.

CreateAsyncForValue<T>(ISqlQueryReaderFactory, string, bool, SqlQueryReaderResultSetFieldsPersistenceMode)

Creates a new compiled SqlAsyncQueryReader<TRow> instance for rows of Value<T> type.

[Pure]
public static SqlAsyncQueryReader<Value<T>> CreateAsyncForValue<T>(this ISqlQueryReaderFactory factory, string fieldName, bool alwaysTestForNull = false, SqlQueryReaderResultSetFieldsPersistenceMode resultSetFieldsPersistenceMode = SqlQueryReaderResultSetFieldsPersistenceMode.Ignore)

Parameters

factory ISqlQueryReaderFactory

Source factory.

fieldName string

Name of the SQL field to read as row's value.

alwaysTestForNull bool

Specifies whether fieldName values should be tested for null. Equal to false by default.

resultSetFieldsPersistenceMode SqlQueryReaderResultSetFieldsPersistenceMode

Specifies how query result set fields should be extracted, if at all. Equal to Ignore by default.

Returns

SqlAsyncQueryReader<Value<T>>

New SqlAsyncQueryReader<TRow> instance.

Type Parameters

T

Row's value type.

CreateAsyncScalarExpression<T>(ISqlQueryReaderFactory, bool)

[Pure]
public static SqlAsyncScalarQueryReaderExpression<T> CreateAsyncScalarExpression<T>(this ISqlQueryReaderFactory factory, bool isNullable = false)

Parameters

factory ISqlQueryReaderFactory

Source factory.

isNullable bool

Specifies whether the result is nullable. Equal to false by default.

Returns

SqlAsyncScalarQueryReaderExpression<T>

New SqlAsyncScalarQueryReaderExpression<T> instance.

Type Parameters

T

Value type.

Exceptions

SqlCompilerException

When T is not a valid result type or this factory does not support asynchronous expressions.

CreateAsyncScalar<T>(ISqlQueryReaderFactory, bool)

Creates a new compiled SqlAsyncScalarQueryReader<T> instance.

[Pure]
public static SqlAsyncScalarQueryReader<T> CreateAsyncScalar<T>(this ISqlQueryReaderFactory factory, bool isNullable = false)

Parameters

factory ISqlQueryReaderFactory

Source factory.

isNullable bool

Specifies whether the result is nullable. Equal to false by default.

Returns

SqlAsyncScalarQueryReader<T>

New SqlAsyncScalarQueryReader<T> instance.

Type Parameters

T

Value type.

Exceptions

SqlCompilerException

When T is not a valid result type or this factory does not support asynchronous expressions.

CreateAsync<TRow>(ISqlQueryReaderFactory, SqlQueryReaderCreationOptions?)

Creates a new compiled SqlAsyncQueryReader<TRow> instance.

[Pure]
public static SqlAsyncQueryReader<TRow> CreateAsync<TRow>(this ISqlQueryReaderFactory factory, SqlQueryReaderCreationOptions? options = null) where TRow : notnull

Parameters

factory ISqlQueryReaderFactory

Source factory.

options SqlQueryReaderCreationOptions?

Optional SqlQueryReaderCreationOptions.

Returns

SqlAsyncQueryReader<TRow>

New SqlAsyncQueryReader<TRow> instance.

Type Parameters

TRow

Row type.

Exceptions

SqlCompilerException

When TRow is not a valid row type or does not contain a valid constructor or does not contain any valid members or this factory does not support asynchronous expressions.

CreateExpressionForValue<T>(ISqlParameterBinderFactory, string, bool, bool, SqlNodeInterpreterContext?)

Creates a new SqlParameterBinderExpression<TSource> instance for sources of Value<T> type.

[Pure]
public static SqlParameterBinderExpression<Value<T>> CreateExpressionForValue<T>(this ISqlParameterBinderFactory factory, string parameterName, bool isParameterPositional = false, bool ignoreNullValue = false, SqlNodeInterpreterContext? context = null)

Parameters

factory ISqlParameterBinderFactory

Source factory.

parameterName string

Name of the SQL parameter.

isParameterPositional bool

Specifies whether the SQL parameter is positional. Positional parameter will be assigned an index value of 0. Equal to false by default.

ignoreNullValue bool

Specifies whether null parameter value will be completely ignored. Equal to false by default.

context SqlNodeInterpreterContext

Optional SqlNodeInterpreterContext instance used for further parameter validation.

Returns

SqlParameterBinderExpression<Value<T>>

New SqlParameterBinderExpression<TSource> instance.

Type Parameters

T

Parameter's value type.

CreateExpressionForValue<T>(ISqlQueryReaderFactory, string, bool, SqlQueryReaderResultSetFieldsPersistenceMode)

Creates a new SqlQueryReaderExpression<TRow> instance for rows of Value<T> type.

[Pure]
public static SqlQueryReaderExpression<Value<T>> CreateExpressionForValue<T>(this ISqlQueryReaderFactory factory, string fieldName, bool alwaysTestForNull = false, SqlQueryReaderResultSetFieldsPersistenceMode resultSetFieldsPersistenceMode = SqlQueryReaderResultSetFieldsPersistenceMode.Ignore)

Parameters

factory ISqlQueryReaderFactory

Source factory.

fieldName string

Name of the SQL field to read as row's value.

alwaysTestForNull bool

Specifies whether fieldName values should be tested for null. Equal to false by default.

resultSetFieldsPersistenceMode SqlQueryReaderResultSetFieldsPersistenceMode

Specifies how query result set fields should be extracted, if at all. Equal to Ignore by default.

Returns

SqlQueryReaderExpression<Value<T>>

New SqlQueryReaderExpression<TRow> instance.

Type Parameters

T

Row's value type.

CreateExpression<TSource>(ISqlParameterBinderFactory, SqlParameterBinderCreationOptions?)

Creates a new SqlParameterBinderExpression<TSource> instance.

[Pure]
public static SqlParameterBinderExpression<TSource> CreateExpression<TSource>(this ISqlParameterBinderFactory factory, SqlParameterBinderCreationOptions? options = null) where TSource : notnull

Parameters

factory ISqlParameterBinderFactory

Source factory.

options SqlParameterBinderCreationOptions?

Optional SqlParameterBinderCreationOptions.

Returns

SqlParameterBinderExpression<TSource>

New SqlParameterBinderExpression<TSource> instance.

Type Parameters

TSource

Parameter source type.

Exceptions

SqlCompilerException

When TSource is not a valid parameter source type or does not contain any valid members.

CreateExpression<TRow>(ISqlQueryReaderFactory, SqlQueryReaderCreationOptions?)

Creates a new SqlQueryReaderExpression<TRow> instance.

[Pure]
public static SqlQueryReaderExpression<TRow> CreateExpression<TRow>(this ISqlQueryReaderFactory factory, SqlQueryReaderCreationOptions? options = null) where TRow : notnull

Parameters

factory ISqlQueryReaderFactory

Source factory.

options SqlQueryReaderCreationOptions?

Optional SqlQueryReaderCreationOptions.

Returns

SqlQueryReaderExpression<TRow>

New SqlQueryReaderExpression<TRow> instance.

Type Parameters

TRow

Row type.

Exceptions

SqlCompilerException

When TRow is not a valid row type or does not contain a valid constructor or does not contain any valid members.

CreateForValue<T>(ISqlParameterBinderFactory, string, bool, bool, SqlNodeInterpreterContext?)

Creates a new compiled SqlParameterBinder<TSource> instance for sources of Value<T> type.

[Pure]
public static SqlParameterBinder<Value<T>> CreateForValue<T>(this ISqlParameterBinderFactory factory, string parameterName, bool isParameterPositional = false, bool ignoreNullValue = false, SqlNodeInterpreterContext? context = null)

Parameters

factory ISqlParameterBinderFactory

Source factory.

parameterName string

Name of the SQL parameter.

isParameterPositional bool

Specifies whether the SQL parameter is positional. Positional parameter will be assigned an index value of 0. Equal to false by default.

ignoreNullValue bool

Specifies whether null parameter value will be completely ignored. Equal to false by default.

context SqlNodeInterpreterContext

Optional SqlNodeInterpreterContext instance used for further parameter validation.

Returns

SqlParameterBinder<Value<T>>

New SqlParameterBinder<TSource> instance.

Type Parameters

T

Parameter's value type.

CreateForValue<T>(ISqlQueryReaderFactory, string, bool, SqlQueryReaderResultSetFieldsPersistenceMode)

Creates a new compiled SqlQueryReader<TRow> instance for rows of Value<T> type.

[Pure]
public static SqlQueryReader<Value<T>> CreateForValue<T>(this ISqlQueryReaderFactory factory, string fieldName, bool alwaysTestForNull = false, SqlQueryReaderResultSetFieldsPersistenceMode resultSetFieldsPersistenceMode = SqlQueryReaderResultSetFieldsPersistenceMode.Ignore)

Parameters

factory ISqlQueryReaderFactory

Source factory.

fieldName string

Name of the SQL field to read as row's value.

alwaysTestForNull bool

Specifies whether fieldName values should be tested for null. Equal to false by default.

resultSetFieldsPersistenceMode SqlQueryReaderResultSetFieldsPersistenceMode

Specifies how query result set fields should be extracted, if at all. Equal to Ignore by default.

Returns

SqlQueryReader<Value<T>>

New SqlQueryReader<TRow> instance.

Type Parameters

T

Row's value type.

CreateScalarExpression<T>(ISqlQueryReaderFactory, bool)

Creates a new SqlScalarQueryReaderExpression<T> instance.

[Pure]
public static SqlScalarQueryReaderExpression<T> CreateScalarExpression<T>(this ISqlQueryReaderFactory factory, bool isNullable = false)

Parameters

factory ISqlQueryReaderFactory

Source factory.

isNullable bool

Specifies whether the result is nullable. Equal to false by default.

Returns

SqlScalarQueryReaderExpression<T>

New SqlScalarQueryReaderExpression<T> instance.

Type Parameters

T

Value type.

Exceptions

SqlCompilerException

When T is not a valid result type.

CreateScalar<T>(ISqlQueryReaderFactory, bool)

Creates a new compiled SqlScalarQueryReader<T> instance.

[Pure]
public static SqlScalarQueryReader<T> CreateScalar<T>(this ISqlQueryReaderFactory factory, bool isNullable = false)

Parameters

factory ISqlQueryReaderFactory

Source factory.

isNullable bool

Specifies whether the result is nullable. Equal to false by default.

Returns

SqlScalarQueryReader<T>

New SqlScalarQueryReader<T> instance.

Type Parameters

T

Value type.

Exceptions

SqlCompilerException

When T is not a valid result type.

Create<TSource>(ISqlParameterBinderFactory, SqlParameterBinderCreationOptions?)

Creates a new compiled SqlParameterBinder<TSource> instance.

[Pure]
public static SqlParameterBinder<TSource> Create<TSource>(this ISqlParameterBinderFactory factory, SqlParameterBinderCreationOptions? options = null) where TSource : notnull

Parameters

factory ISqlParameterBinderFactory

Source factory.

options SqlParameterBinderCreationOptions?

Optional SqlParameterBinderCreationOptions.

Returns

SqlParameterBinder<TSource>

New SqlParameterBinder<TSource> instance.

Type Parameters

TSource

Parameter source type.

Exceptions

SqlCompilerException

When TSource is not a valid parameter source type or does not contain any valid members.

Create<TRow>(ISqlQueryReaderFactory, SqlQueryReaderCreationOptions?)

Creates a new compiled SqlQueryReader<TRow> instance.

[Pure]
public static SqlQueryReader<TRow> Create<TRow>(this ISqlQueryReaderFactory factory, SqlQueryReaderCreationOptions? options = null) where TRow : notnull

Parameters

factory ISqlQueryReaderFactory

Source factory.

options SqlQueryReaderCreationOptions?

Optional SqlQueryReaderCreationOptions.

Returns

SqlQueryReader<TRow>

New SqlQueryReader<TRow> instance.

Type Parameters

TRow

Row type.

Exceptions

SqlCompilerException

When TRow is not a valid row type or does not contain a valid constructor or does not contain any valid members.