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. |
xao |
DevExpress. |
xbwo |
DevExpress. |
xbo |
DevExpress. |
xfo |
DevExpress. |
xgo |
DevExpress. |
xio |
DevExpress. |
xuo |
DevExpress. |
xss |
DevExpress. |
xu |
DevExpress. |
xcl |
For more information on type mnemonics, see the Dynamic Lists options page description.