Skip to main content
.NET 6.0+

CalculatedAttribute Class

Applied to business class properties. Specifies an expression used to calculate the target property value in the Data View mode.

Namespace: DevExpress.ExpressApp.DC

Assembly: DevExpress.ExpressApp.v23.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[AttributeUsage(AttributeTargets.Property, Inherited = true)]
public class CalculatedAttribute :
    Attribute

Remarks

Below is an example of using the CalculatedAttribute.

using DevExpress.ExpressApp.DC;
// ...
public class Person {    
    // ...
    public virtual String FirstName { get; set; }
    public virtual String LastName { get; set; }
    [Calculated("Concat(FirstName, ' ', LastName)")]
    public String FullName {
        get {
            return string.Concat(FirstName, " ", LastName);
        }
    }
}

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.

Properties, used in the CalculatedAttribute.Expression should be persistent to be able to run an SQL query at the database level.

Inheritance

Object
Attribute
CalculatedAttribute
See Also