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
factoryISqlQueryReaderFactorySource factory.
fieldNamestringName of the SQL field to read as row's value.
alwaysTestForNullboolSpecifies whether
fieldNamevalues should be tested for null. Equal to false by default.resultSetFieldsPersistenceModeSqlQueryReaderResultSetFieldsPersistenceModeSpecifies 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
TRow'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
factoryISqlQueryReaderFactorySource factory.
optionsSqlQueryReaderCreationOptions?Optional SqlQueryReaderCreationOptions.
Returns
- SqlAsyncQueryReaderExpression<TRow>
New SqlAsyncQueryReaderExpression<TRow> instance.
Type Parameters
TRowRow type.
Exceptions
- SqlCompilerException
When
TRowis 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
factoryISqlQueryReaderFactorySource factory.
fieldNamestringName of the SQL field to read as row's value.
alwaysTestForNullboolSpecifies whether
fieldNamevalues should be tested for null. Equal to false by default.resultSetFieldsPersistenceModeSqlQueryReaderResultSetFieldsPersistenceModeSpecifies 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
TRow's value type.
CreateAsyncScalarExpression<T>(ISqlQueryReaderFactory, bool)
Creates a new SqlAsyncScalarQueryReaderExpression<T> instance.
[Pure]
public static SqlAsyncScalarQueryReaderExpression<T> CreateAsyncScalarExpression<T>(this ISqlQueryReaderFactory factory, bool isNullable = false)
Parameters
factoryISqlQueryReaderFactorySource factory.
isNullableboolSpecifies whether the result is nullable. Equal to false by default.
Returns
Type Parameters
TValue type.
Exceptions
- SqlCompilerException
When
Tis 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
factoryISqlQueryReaderFactorySource factory.
isNullableboolSpecifies whether the result is nullable. Equal to false by default.
Returns
- SqlAsyncScalarQueryReader<T>
New SqlAsyncScalarQueryReader<T> instance.
Type Parameters
TValue type.
Exceptions
- SqlCompilerException
When
Tis 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
factoryISqlQueryReaderFactorySource factory.
optionsSqlQueryReaderCreationOptions?Optional SqlQueryReaderCreationOptions.
Returns
- SqlAsyncQueryReader<TRow>
New SqlAsyncQueryReader<TRow> instance.
Type Parameters
TRowRow type.
Exceptions
- SqlCompilerException
When
TRowis 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
factoryISqlParameterBinderFactorySource factory.
parameterNamestringName of the SQL parameter.
isParameterPositionalboolSpecifies whether the SQL parameter is positional. Positional parameter will be assigned an index value of 0. Equal to false by default.
ignoreNullValueboolSpecifies whether null parameter value will be completely ignored. Equal to false by default.
contextSqlNodeInterpreterContextOptional SqlNodeInterpreterContext instance used for further parameter validation.
Returns
- SqlParameterBinderExpression<Value<T>>
New SqlParameterBinderExpression<TSource> instance.
Type Parameters
TParameter'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
factoryISqlQueryReaderFactorySource factory.
fieldNamestringName of the SQL field to read as row's value.
alwaysTestForNullboolSpecifies whether
fieldNamevalues should be tested for null. Equal to false by default.resultSetFieldsPersistenceModeSqlQueryReaderResultSetFieldsPersistenceModeSpecifies 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
TRow'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
factoryISqlParameterBinderFactorySource factory.
optionsSqlParameterBinderCreationOptions?Optional SqlParameterBinderCreationOptions.
Returns
- SqlParameterBinderExpression<TSource>
New SqlParameterBinderExpression<TSource> instance.
Type Parameters
TSourceParameter source type.
Exceptions
- SqlCompilerException
When
TSourceis 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
factoryISqlQueryReaderFactorySource factory.
optionsSqlQueryReaderCreationOptions?Optional SqlQueryReaderCreationOptions.
Returns
- SqlQueryReaderExpression<TRow>
New SqlQueryReaderExpression<TRow> instance.
Type Parameters
TRowRow type.
Exceptions
- SqlCompilerException
When
TRowis 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
factoryISqlParameterBinderFactorySource factory.
parameterNamestringName of the SQL parameter.
isParameterPositionalboolSpecifies whether the SQL parameter is positional. Positional parameter will be assigned an index value of 0. Equal to false by default.
ignoreNullValueboolSpecifies whether null parameter value will be completely ignored. Equal to false by default.
contextSqlNodeInterpreterContextOptional SqlNodeInterpreterContext instance used for further parameter validation.
Returns
- SqlParameterBinder<Value<T>>
New SqlParameterBinder<TSource> instance.
Type Parameters
TParameter'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
factoryISqlQueryReaderFactorySource factory.
fieldNamestringName of the SQL field to read as row's value.
alwaysTestForNullboolSpecifies whether
fieldNamevalues should be tested for null. Equal to false by default.resultSetFieldsPersistenceModeSqlQueryReaderResultSetFieldsPersistenceModeSpecifies 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
TRow'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
factoryISqlQueryReaderFactorySource factory.
isNullableboolSpecifies whether the result is nullable. Equal to false by default.
Returns
- SqlScalarQueryReaderExpression<T>
New SqlScalarQueryReaderExpression<T> instance.
Type Parameters
TValue type.
Exceptions
- SqlCompilerException
When
Tis 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
factoryISqlQueryReaderFactorySource factory.
isNullableboolSpecifies whether the result is nullable. Equal to false by default.
Returns
- SqlScalarQueryReader<T>
New SqlScalarQueryReader<T> instance.
Type Parameters
TValue type.
Exceptions
- SqlCompilerException
When
Tis 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
factoryISqlParameterBinderFactorySource factory.
optionsSqlParameterBinderCreationOptions?Optional SqlParameterBinderCreationOptions.
Returns
- SqlParameterBinder<TSource>
New SqlParameterBinder<TSource> instance.
Type Parameters
TSourceParameter source type.
Exceptions
- SqlCompilerException
When
TSourceis 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
factoryISqlQueryReaderFactorySource factory.
optionsSqlQueryReaderCreationOptions?Optional SqlQueryReaderCreationOptions.
Returns
- SqlQueryReader<TRow>
New SqlQueryReader<TRow> instance.
Type Parameters
TRowRow type.
Exceptions
- SqlCompilerException
When
TRowis not a valid row type or does not contain a valid constructor or does not contain any valid members.