A newer version of this page is available. Switch to the current version.

XPBaseObject.EvaluateAlias(String) Method

Evaluates an expression specified by the PersistentAliasAttribute attribute for the specified property.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v18.2.dll


public object EvaluateAlias(
    string memberName
Public Function EvaluateAlias(
    memberName As String
) As Object


Name Type Description
memberName String

A string that specifies the name of the property that is declared with the PersistentAliasAttribute attribute.


Type Description

A value evaluated.


The PersistentAliasAttribute attribute indicates that a property is not persistent and it's value is calculated based upon the values of a specific persistent field(s). A parameter of this attribute can specify an expression and the result of this expression can represent the property's value.

Use the EvaluateAlias method to evaluate an expression specified by the PersistentAliasAttribute attribute. For instance, it can be used in a property's implementation as shown in the example below.


The following code shows how to define a property as non-persistent and calculate its value based upon the values of specific persistent fields. The ExtendedPrice property is marked as a non-persistent, using the PersistentAliasAttribute attribute. The expression to evaluate the property's value is specified as the attribute's parameter. In addition, the property's getter evaluates this expression using the XPBaseObject.EvaluateAlias method.

using DevExpress.Xpo;

public class Order : XPObject {
   public Order() {}
   public decimal UnitPrice;
   public int Qty;
   public decimal Discount;

   public decimal ExtendedPrice {
      get { return Convert.ToDecimal(EvaluateAlias("ExtendedPrice")); }
See Also