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.

BaseObject.EvaluateAlias(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 object EvaluateAlias(
    string propertyName = null
)

Optional Parameters

Name Type Default Description
propertyName String null

Specifies the name of a property value to be calculated.

Returns

Type Description
Object

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 {
        get { return (decimal)EvaluateAlias(); }
    }
}
See Also