XPO and XAF Templates

This topic describes templates from the Templates Library that increase efficiency of working with 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. The example is presented for the xps (string) template.

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

XPO-associated property

Template: xpa

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

XPO-associated collection

Template: xpcl

[Association("Program-Relations")]
public XPCollection<RelationType> Relations {
    get {
        return GetCollection<RelationType>("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. The example is presented for the xri (Integer) template.

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

XPO Types

In addition to the System types described in the Members Declaration article, CodeRush includes XPO type mnemonics, which can be used 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 (pxss template) to declare a property of the DevExpress.Xpo.Session type.

See Also