Class Sql.ExtensionAttribute
- Namespace
- LinqToDB
- Assembly
- linq2db.dll
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Property, AllowMultiple = true)]
public class Sql.ExtensionAttribute : Sql.ExpressionAttribute, _Attribute
- Inheritance
-
objectSql.ExtensionAttribute
- Implements
- Inherited Members
- Extension Methods
Constructors
ExtensionAttribute(string)
public ExtensionAttribute(string expression)
Parameters
expressionstring
ExtensionAttribute(string, string)
public ExtensionAttribute(string configuration, string expression)
Parameters
ExtensionAttribute(string, Type)
public ExtensionAttribute(string configuration, Type builderType)
Parameters
ExtensionAttribute(Type)
public ExtensionAttribute(Type builderType)
Parameters
builderTypeType
Properties
BuilderType
public Type? BuilderType { get; set; }
Property Value
BuilderValue
public object? BuilderValue { get; set; }
Property Value
- object
ChainPrecedence
Defines in which order process extensions. Items will be ordered Descending.
public int ChainPrecedence { get; set; }
Property Value
TokenName
public string? TokenName { get; set; }
Property Value
Methods
BuildFunctionsChain<TContext>(TContext, IDataContext, IExpressionEvaluator, SelectQuery, Expression, ConvertFunc<TContext>, out Expression?)
protected List<Sql.SqlExtensionParam>? BuildFunctionsChain<TContext>(TContext context, IDataContext dataContext, IExpressionEvaluator evaluator, SelectQuery query, Expression expr, Sql.ExpressionAttribute.ConvertFunc<TContext> converter, out Expression? error)
Parameters
contextTContextdataContextIDataContextevaluatorIExpressionEvaluatorquerySelectQueryexprExpressionconverterSql.ExpressionAttribute.ConvertFunc<TContext>errorExpression
Returns
Type Parameters
TContext
BuildSqlExpression(MappingSchema, SelectQuery, SqlExtension, Type, int, SqlFlags, bool?, IsNullableType)
public static Expression BuildSqlExpression(MappingSchema mappingSchema, SelectQuery query, Sql.SqlExtension root, Type systemType, int precedence, SqlFlags flags, bool? canBeNull, Sql.IsNullableType isNullable)
Parameters
mappingSchemaMappingSchemaquerySelectQueryrootSql.SqlExtensionsystemTypeTypeprecedenceintflagsSqlFlagscanBeNullbool?isNullableSql.IsNullableType
Returns
ExcludeExtensionChain(MappingSchema, Expression, out bool)
public static Expression ExcludeExtensionChain(MappingSchema mapping, Expression expr, out bool isQueryable)
Parameters
mappingMappingSchemaexprExpressionisQueryablebool
Returns
GetExpression<TContext>(TContext, IDataContext, IExpressionEvaluator, SelectQuery, Expression, ConvertFunc<TContext>)
Builds SQL for the extension member or method call.
public override Expression GetExpression<TContext>(TContext context, IDataContext dataContext, IExpressionEvaluator evaluator, SelectQuery query, Expression expression, Sql.ExpressionAttribute.ConvertFunc<TContext> converter)
Parameters
contextTContextContext, passed to
converteron each call.dataContextIDataContextData context, which query is built for.
evaluatorIExpressionEvaluatorEvaluator, used to calculate values of client-side expressions.
querySelectQueryQuery, which the extension belongs to.
expressionExpressionExtension member or method call expression.
converterSql.ExpressionAttribute.ConvertFunc<TContext>Function, which translates an expression to SQL. An expression, which it translates successfully, has its value supplied to the database through a parameter, which is re-read from the query expression on every execution, or through an inlined literal, which the parameters context registers for comparison. Either way the extension does not have to make it a part of the query cache key itself. Value, which is read instead of being translated, is baked into generated SQL and has to be compared on query cache lookup - see GetExpression(int, bool, bool?).
Returns
- Expression
Expression with generated SQL, or an error expression when the extension cannot be translated.
Type Parameters
TContextType of the context, passed to
converter.
GetExtensionAttributes(Expression, MappingSchema, bool)
public static Sql.ExtensionAttribute[] GetExtensionAttributes(Expression expression, MappingSchema mapping, bool forFirstConfiguration = true)
Parameters
expressionExpressionmappingMappingSchemaforFirstConfigurationbool
Returns
GetObjectID()
Returns mapping attribute id, based on all attribute options.
public override string GetObjectID()