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
-
objectSql.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
namestringThe 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
configurationstringThe ProviderName the property will be used under.
namestringThe name of the property.
Properties
Name
The name of the Property.
public string? Name { get; set; }
Property Value
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
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.
GetObjectID()
Returns mapping attribute id, based on all attribute options.
public override string GetObjectID()