Skip to main content
All docs
V24.2
.NET 8.0+
  • The page you are viewing does not exist in the .NET Framework 4.6.2+ platform documentation. This link will take you to the parent topic of the current section.

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PersistentAliasAttribute Class

Applies to EF Core business class properties. Specifies an expression used to calculate the target property value.

Namespace: DevExpress.ExpressApp.DC

Assembly: DevExpress.ExpressApp.EFCore.v24.2.dll

NuGet Package: DevExpress.ExpressApp.EFCore

#Declaration

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

#Remarks

Use the PersistentAliasAttribute to specify an expression used to calculate the value of a calculated property.

In an EF Core business class, a property decorated with the PersistentAliasAttribute works like a regular property in all data access modes. Note that for an EF Core class property, the PersistentAliasAttribute has the same effect as the CalculatedAttribute.

The following code snippet uses the PersistentAliasAttribute:

using DevExpress.ExpressApp.DC;
// ...
public class Person : BaseObject {
    // ...
    public virtual String FirstName { get; set; }
    public virtual String LastName { get; set; }
    [PersistentAlias("Concat(FirstName, ' ', LastName)")]
    public String FullName {
        get {
            get { return EvaluateAlias<String>(); }
        }
    }
}
// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.

The expression specified through the CalculatedAttribute.Expression parameter is calculated on the database server side. The expression can reference persistent properties, other calculated properties, or criteria functions that can be executed by the database server through SQL.

#Inheritance

Object
Attribute
CalculatedAttribute
PersistentAliasAttribute
See Also