Skip to main content

XPO Templates

  • 2 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; }
}

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