Class PseudoFunctions
Contains names and create helpers for pseudo-functions, generated by linq2db and then converted to database-specific SQL by provider-specific SQL optimizer.
public static class PseudoFunctions
- Inheritance
-
PseudoFunctions
Fields
COALESCE
Function to return first non-null argument: COALESCE(values...)
public const string COALESCE = "$Coalesce$"
Field Value
CONVERT
Function to convert value from one type to another: CONVERT(to_type, from_type, value) { CanBeNull = value.CanBeNull }
public const string CONVERT = "$Convert$"
Field Value
REMOVE_CONVERT
Function to suppress conversion SQL generation for provided value: REMOVE_CONVERT(value, resultType)
public const string REMOVE_CONVERT = "$Convert_Remover$"
Field Value
REPLACE
Function to replace one text fragment with another in string: REPLACE(value, oldSubstring, newSubstring)
public const string REPLACE = "$Replace$"
Field Value
TO_LOWER
Function to convert text parameter to lowercased form: TO_LOWER(string)
public const string TO_LOWER = "$ToLower$"
Field Value
TO_UPPER
Function to convert text parameter to uppercased form: TO_UPPER(string)
public const string TO_UPPER = "$ToUpper$"
Field Value
TRY_CONVERT
Function to convert value from one type to another: TRY_CONVERT(to_type, from_type, value) { CanBeNull = true }
.
Returns NULL on conversion failure.
public const string TRY_CONVERT = "$TryConvert$"
Field Value
TRY_CONVERT_OR_DEFAULT
Function to convert value from one type to another: TRY_CONVERT_OR_DEFAULT(to_type, from_type, value, defaultValue) { CanBeNull = value.CanBeNull || defaultValue.CanBeNull }
.
Returns provided default value on conversion failure.
public const string TRY_CONVERT_OR_DEFAULT = "$TryConvertOrDefault$"
Field Value
Methods
MakeCoalesce(Type, params ISqlExpression[])
public static SqlFunction MakeCoalesce(Type systemType, params ISqlExpression[] values)
Parameters
systemType
Typevalues
ISqlExpression[]
Returns
MakeConvert(SqlDataType, SqlDataType, ISqlExpression)
public static SqlFunction MakeConvert(SqlDataType toType, SqlDataType fromType, ISqlExpression value)
Parameters
toType
SqlDataTypefromType
SqlDataTypevalue
ISqlExpression
Returns
MakeRemoveConvert(ISqlExpression, SqlDataType)
public static SqlFunction MakeRemoveConvert(ISqlExpression value, SqlDataType resultType)
Parameters
value
ISqlExpressionresultType
SqlDataType
Returns
MakeReplace(ISqlExpression, ISqlExpression, ISqlExpression)
public static SqlFunction MakeReplace(ISqlExpression value, ISqlExpression oldSubstring, ISqlExpression newSubstring)
Parameters
value
ISqlExpressionoldSubstring
ISqlExpressionnewSubstring
ISqlExpression
Returns
MakeToLower(ISqlExpression)
public static SqlFunction MakeToLower(ISqlExpression value)
Parameters
value
ISqlExpression
Returns
MakeToUpper(ISqlExpression)
public static SqlFunction MakeToUpper(ISqlExpression value)
Parameters
value
ISqlExpression
Returns
MakeTryConvert(SqlDataType, SqlDataType, ISqlExpression)
public static SqlFunction MakeTryConvert(SqlDataType toType, SqlDataType fromType, ISqlExpression value)
Parameters
toType
SqlDataTypefromType
SqlDataTypevalue
ISqlExpression
Returns
MakeTryConvertOrDefault(SqlDataType, SqlDataType, ISqlExpression, ISqlExpression)
public static SqlFunction MakeTryConvertOrDefault(SqlDataType toType, SqlDataType fromType, ISqlExpression value, ISqlExpression defaultValue)
Parameters
toType
SqlDataTypefromType
SqlDataTypevalue
ISqlExpressiondefaultValue
ISqlExpression