Skip to main content
A newer version of this page is available. .

XPO and XAF Templates

  • 2 minutes to read

This topic describes templates you can use when you implement business classes in eXpressApp Framework (XAF) and eXpress Persistent Objects (XPO).

Member declaration

XPO persistent class

Template: xc

public class PersistentClass : XPObject {
    public PersistentClass(Session session) : base(session) { }
}

XPO persistent property

Template: xp*

* This template must be followed by a type mnemonic. For details, refer to the Members Declaration article. xps (string) template.

string propertyName;
[Size(SizeAttribute.DefaultStringMappingFieldSize)]
public string PropertyName {
    get => propertyName;
    set => SetPropertyValue(nameof(PropertyName), ref propertyName, value);
}

XPO-associated property

Template: xpa

object propertyName;
[Association("object-Programs")]
public object PropertyName {
    get => propertyName;
    set => SetPropertyValue(nameof(PropertyName), ref propertyName, value);
}

XPO-associated collection

Template: xpcl

[Association("Program-Relations")]
public XPCollection<RelationType> Relations {
    get {
        return GetCollection<RelationType>(nameof(Relations));
    }
}

XPO read-only persistent property

Template: xr*

* This template must be followed by a type mnemonic. For details, refer to the Members Declaration article. xri (Integer) template.

[Persistent(nameof(PropertyName))]
int propertyName;
[PersistentAlias(nameof(propertyName))]
public int PropertyName {
    get { return propertyName; }
}

XPO Types

CodeRush includes XPO type mnemonics you can use in member declaration templates.

Type Mnemonic
DevExpress.Data.Filtering.AggregateOperand xao
DevExpress.Data.Filtering.BetweenOperator xbwo
DevExpress.Data.Filtering.BinaryOperator xbo
DevExpress.Data.Filtering.FunctionOperator xfo
DevExpress.Data.Filtering.GroupOperator xgo
DevExpress.Data.Filtering.InOperator xio
DevExpress.Data.Filtering.UnaryOperator xuo
DevExpress.Xpo.Session xss
DevExpress.Xpo.UnitOfWork xu
DevExpress.Xpo.XPCollection xcl

For instance, you can use the p template with the xss mnemonic (the pxss template) to declare a DevExpress.Xpo.Session type property.

DevExpress.Xpo.Session propertyName;

public DevExpress.Xpo.Session PropertyName {
    get { return propertyName; }
    set {
        propertyName = value;
    }
}
See Also