Table of Contents

Class Sql.PropertyAttribute

Namespace
LinqToDB
Assembly
linq2db.dll

An attribute used to define a static value or a Database side property/method that takes no parameters.

[Serializable]
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Property, AllowMultiple = true, Inherited = false)]
public class Sql.PropertyAttribute : Sql.ExpressionAttribute, _Attribute
Inheritance
object
Sql.PropertyAttribute
Implements
Inherited Members
Extension Methods

Constructors

PropertyAttribute()

Creates a property to be used in SQL The name of the Property/Method will be used.

public PropertyAttribute()

PropertyAttribute(string)

Creates a Property to be used in SQL.

public PropertyAttribute(string name)

Parameters

name string

The name of the property.

PropertyAttribute(string, string)

Creates a property to be used in SQL for the given ProviderName.

public PropertyAttribute(string configuration, string name)

Parameters

configuration string

The ProviderName the property will be used under.

name string

The name of the property.

Properties

Name

The name of the Property.

public string? Name { get; set; }

Property Value

string

Methods

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

context TContext

Context, passed to converter on each call.

dataContext IDataContext

Data context, which query is built for.

evaluator IExpressionEvaluator

Evaluator, used to calculate values of client-side expressions.

query SelectQuery

Query, which the extension belongs to.

expression Expression

Extension member or method call expression.

converter Sql.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

TContext

Type of the context, passed to converter.

GetObjectID()

Returns mapping attribute id, based on all attribute options.

public override string GetObjectID()

Returns

string