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

XPO Templates

  • 3 minutes to read

This topic describes templates you can use when you implement business classes in 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[1]

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[2]

[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;
    }
}

Note

Visual Studio IntelliSense has priority over CodeRush templates. For information on how to prioritize CodeRush template over Visual Studio IntelliSense, refer to the following topic section: Expand a Template Instead of Visual Studio IntelliSense.

Footnotes
  1. The xp template must be followed by a type mnemonic. For example, s for string.

  2. The xr template must be followed by a type mnemonic. For example, i for integer.

See Also