Prompted by Stefan Renzewitz in the CodeRush newsgroup, I’m making available a number of CodeRush templates, which allow you to create persistent properties of various types, including collections and association properties for “the other side” of the collection property. I guess a variant of these templates will be included in the default distribution of CodeRush in the future, but until that happens, please import the file from the download below. Sorry, C# only for now.
These are the templates:
pp(b|c|d|dt|f|i|o|s)
:
private <type> propertyName;
public <type> PropertyName {
get {
return propertyName;
}
set {
if (propertyName != value) {
<type> oldValue = propertyName;
propertyName = value;
OnChanged("PropertyName", oldValue, propertyName);
}
}
}
Depending on the postfix used, the “<type>” in the code is expanded into bool, char, decimal, DateTime, float, int, object or string.
pcoll
:
[Association("PersistentClass-Relations")]
public XPCollection<RelationType> Relations {
get {
return GetCollection<RelationType>("Relations");
}
}
ppa
(the “a” is for “association”):
private object propertyName;
[Association("object-PersistentClasss")]
public object PropertyName {
get {
return propertyName;
}
set {
if (propertyName != value) {
object oldValue = propertyName;
propertyName = value;
OnChanged("PropertyName", oldValue, propertyName);
}
}
}
Of course it’s a little difficult to describe how exactly these templates work, so I suggest you download the file below, import it into CodeRush and try them out! Oh yes, for the import you just enter the CodeRush Options dialog, switch to the Templates page, right-click anywhere in the hierarchical list of templates and click the “Import Templates…” context menu command. Have fun!
File Attachment: CSharp_Oliver_XPO.xml (48 KB)
Free DevExpress Products - Get Your Copy Today
The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the
DevExpress Support Center at your convenience. We'll be happy to follow-up.