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

BaseObject.EvaluateAlias<T>(String) Method

Calculates the value of a calculated property whose name is specified by the propertyName parameter. The expression used in calculation must be specified through the PersistentAlias or Calculated attribute.

Namespace: DevExpress.Persistent.BaseImpl.EF

Assembly: DevExpress.Persistent.BaseImpl.EFCore.v24.2.dll

NuGet Package: DevExpress.Persistent.BaseImpl.EFCore

#Declaration

protected T EvaluateAlias<T>(
    string propertyName = null
)

#Optional Parameters

Name Type Default Description
propertyName String null

Specifies the name of a property value to be calculated.

#Type Parameters

Name Description
T

The calculated property value type.

#Returns

Type Description
T

The calculated property value.

#Remarks

Use the EvaluateAlias method to calculate the value of a calculated property.

The propertyName parameter specifies the name of a property value to be calculated. If this parameter is not specified and the EvaluateAlias method is called in a property getter, the propertyName parameter is automatically set to this property’s name.

The following code snippet uses the EvaluateAlias method:

using DevExpress.ExpressApp.DC;
using DevExpress.ExpressApp.Model;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl.EF;

[DefaultClassOptions]
public class Payment : BaseObject {
    [ModelDefault("DisplayFormat", "{0:c}")]
    public virtual decimal Rate { get; set; }
    public virtual decimal Hours { get; set; }

    [ModelDefault("DisplayFormat", "{0:c}")]
    [PersistentAlias("Rate * Hours")]
    public decimal Amount {
        // Ensure that the type parameter `T` is set to the type 
        // that matches the calculated expression result type.
        get { return EvaluateAlias<decimal>(); }
    }
}
See Also