Interface Sql.ISqlExtensionBuilder
- Namespace
- LinqToDB
- Assembly
- linq2db.dll
public interface Sql.ISqlExtensionBuilder
- Extension Methods
Properties
Arguments
Expression[] Arguments { get; }
Property Value
BuilderValue
object? BuilderValue { get; }
Property Value
- object
CanBeNull
bool? CanBeNull { get; }
Property Value
- bool?
Configuration
string? Configuration { get; }
Property Value
DataContext
IDataContext DataContext { get; }
Property Value
Expression
string Expression { get; set; }
Property Value
Extension
Sql.SqlExtension Extension { get; }
Property Value
IsConvertible
bool IsConvertible { get; set; }
Property Value
IsNullable
Sql.IsNullableType IsNullable { get; }
Property Value
Mapping
MappingSchema Mapping { get; }
Property Value
Member
MemberInfo Member { get; }
Property Value
Query
SelectQuery Query { get; }
Property Value
ResultExpression
ISqlExpression? ResultExpression { get; set; }
Property Value
Methods
AddParameter(string, ISqlExpression)
Sql.SqlExtensionParam AddParameter(string name, ISqlExpression expr)
Parameters
namestringexprISqlExpression
Returns
ConvertExpressionToSql(Expression, bool, bool?)
ISqlExpression? ConvertExpressionToSql(Expression expression, bool unwrap = false, bool? inlineParameters = null)
Parameters
expressionExpressionunwrapboolinlineParametersbool?
Returns
ConvertToSqlExpression()
ISqlExpression? ConvertToSqlExpression()
Returns
ConvertToSqlExpression(int)
ISqlExpression? ConvertToSqlExpression(int precedence)
Parameters
precedenceint
Returns
EvaluateExpression(Expression)
object? EvaluateExpression(Expression expression)
Parameters
expressionExpression
Returns
- object
GetExpression(int, bool, bool?)
Translates extension method argument to SQL.
ISqlExpression? GetExpression(int index, bool unwrap = false, bool? inlineParameters = null)
Parameters
indexintArgument position in the extension method call.
unwrapboolWhen true, conversion operators are removed from the argument expression before translation.
inlineParametersbool?When true, argument value is rendered as a literal instead of a parameter. null keeps current query setting.
Returns
- ISqlExpression
Argument SQL or null when argument cannot be translated.
Remarks
Translated argument travels to the database as a parameter, whose value is re-read from the query
expression on every execution, or as a literal when inlineParameters is
true, in which case the parameters context registers the value for comparison. Either
way the builder does not have to make it a part of the query cache key itself. Argument, read with
GetValue<T>(int) or taken from Arguments instead, is baked into generated
SQL by the builder, so it becomes a part of the query cache key.
GetExpression(string, bool, bool?)
Translates extension method argument to SQL.
ISqlExpression? GetExpression(string argName, bool unwrap = false, bool? inlineParameters = null)
Parameters
argNamestringName of the extension method parameter.
unwrapboolWhen true, conversion operators are removed from the argument expression before translation.
inlineParametersbool?When true, argument value is rendered as a literal instead of a parameter. null keeps current query setting.
Returns
- ISqlExpression
Argument SQL or null when argument cannot be translated.
Remarks
Translated argument travels to the database as a parameter, whose value is re-read from the query
expression on every execution, or as a literal when inlineParameters is
true, in which case the parameters context registers the value for comparison. Either
way the builder does not have to make it a part of the query cache key itself. Argument, read with
GetValue<T>(string) or taken from Arguments instead, is baked into generated
SQL by the builder, so it becomes a part of the query cache key.
GetObjectValue(int)
object GetObjectValue(int index)
Parameters
indexint
Returns
- object
GetObjectValue(string)
object GetObjectValue(string argName)
Parameters
argNamestring
Returns
- object
GetValue<T>(int)
T GetValue<T>(int index)
Parameters
indexint
Returns
- T
Type Parameters
T
Remarks
Read value is baked into generated SQL by the builder, so it becomes a part of the query cache key. See GetExpression(int, bool, bool?) for the translated-argument counterpart. Only the outermost call of a chained extension has its arguments registered, so a builder reading an argument of an inner element must mark it with SqlQueryDependentAttribute to keep the value in the key.
GetValue<T>(string)
T GetValue<T>(string argName)
Parameters
argNamestring
Returns
- T
Type Parameters
T
Remarks
Read value is baked into generated SQL by the builder, so it becomes a part of the query cache key. See GetExpression(string, bool, bool?) for the translated-argument counterpart. Only the outermost call of a chained extension has its arguments registered, so a builder reading an argument of an inner element must mark it with SqlQueryDependentAttribute to keep the value in the key.