Table of Contents

Interface Sql.ISqlExtensionBuilder

Namespace
LinqToDB
Assembly
linq2db.dll
public interface Sql.ISqlExtensionBuilder
Extension Methods

Properties

Arguments

Expression[] Arguments { get; }

Property Value

Expression[]

BuilderValue

object? BuilderValue { get; }

Property Value

object

CanBeNull

bool? CanBeNull { get; }

Property Value

bool?

Configuration

string? Configuration { get; }

Property Value

string

DataContext

IDataContext DataContext { get; }

Property Value

IDataContext

Expression

string Expression { get; set; }

Property Value

string

Extension

Sql.SqlExtension Extension { get; }

Property Value

Sql.SqlExtension

IsConvertible

bool IsConvertible { get; set; }

Property Value

bool

IsNullable

Sql.IsNullableType IsNullable { get; }

Property Value

Sql.IsNullableType

Mapping

MappingSchema Mapping { get; }

Property Value

MappingSchema

Member

MemberInfo Member { get; }

Property Value

MemberInfo

Query

SelectQuery Query { get; }

Property Value

SelectQuery

ResultExpression

ISqlExpression? ResultExpression { get; set; }

Property Value

ISqlExpression

Methods

AddParameter(string, ISqlExpression)

Sql.SqlExtensionParam AddParameter(string name, ISqlExpression expr)

Parameters

name string
expr ISqlExpression

Returns

Sql.SqlExtensionParam

ConvertExpressionToSql(Expression, bool, bool?)

ISqlExpression? ConvertExpressionToSql(Expression expression, bool unwrap = false, bool? inlineParameters = null)

Parameters

expression Expression
unwrap bool
inlineParameters bool?

Returns

ISqlExpression

ConvertToSqlExpression()

ISqlExpression? ConvertToSqlExpression()

Returns

ISqlExpression

ConvertToSqlExpression(int)

ISqlExpression? ConvertToSqlExpression(int precedence)

Parameters

precedence int

Returns

ISqlExpression

EvaluateExpression(Expression)

object? EvaluateExpression(Expression expression)

Parameters

expression Expression

Returns

object

GetExpression(int, bool, bool?)

Translates extension method argument to SQL.

ISqlExpression? GetExpression(int index, bool unwrap = false, bool? inlineParameters = null)

Parameters

index int

Argument position in the extension method call.

unwrap bool

When true, conversion operators are removed from the argument expression before translation.

inlineParameters bool?

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

argName string

Name of the extension method parameter.

unwrap bool

When true, conversion operators are removed from the argument expression before translation.

inlineParameters bool?

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

index int

Returns

object

GetObjectValue(string)

object GetObjectValue(string argName)

Parameters

argName string

Returns

object

GetValue<T>(int)

T GetValue<T>(int index)

Parameters

index int

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

argName string

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.