Skip to main content

XPO and XAF Templates

  • 2 minutes to read

CodeRush Classic includes several templates intended to increase the efficiency of working with XPO and XAF.

XPO and XAF templates are located in the DevEx\XPO category on the Templates options page. This category includes the following templates.


Template: xc

An XPO persistent class declaration.

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


}

Template: xp

An XPO persistent property declaration of the specified type. The template must be followed by a type mnemonic.

The example shows the xps template expansion. Meaning the string type mnemonic is used.

private string _PropertyName;
public string PropertyName
{
    get
    {
        return _PropertyName;
    }
    set
    {
        SetPropertyValue("PropertyName", ref _PropertyName, value);
    }
}

Template: xpa

An XPO associated property declaration.

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

Template: xpcl

An XPO associated collection declaration.

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

Template: xr

An XPO read-only persistent property declaration of the specified type. The template must be followed by a type mnemonic

The example shows the xrs template expansion. Meaning the string type mnemonic is used.

[Persistent("PropertyName")]
private string _PropertyName;
[PersistentAlias("_PropertyName")]
public string PropertyName
{
    get { return _PropertyName; }
}

In addition, CodeRush Classic includes XPO type mnemonics, which can be used in member declaration templates. For example, you can use the p template with the xss mnemonic to declare a property of the DevExpress.Xpo.Session type.

The following table lists available XPO type mnemonics.

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 more information on type mnemonics, see the Dynamic Lists options page description.

See Also