in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

XPO

eXpress Persistent Objects

CodeRush templates for XPO properties

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)

Published Apr 28 2006, 01:35 PM by Oliver Sturm (Developer Express)
Filed under:
Technorati tags: XPO

Comments

 

Stefan Renzewitz said:

Thanks a lot! Great service Oliver (you are already more American than German ;) and very impressing response time.

Regards,

Stefan
May 2, 2006 4:53 PM
 

Renaud Bompuis said:

Actually, I found and answer to the issue of not being able to save the template in CodeRush:
https://www.devexpress.com/support/center/Default.aspx?view=ViewIssue&issueid=DB9058

That fixed the problem.
Sorry for posting it here.

Renaud
May 29, 2006 4:15 AM

Leave a Comment

(required)  
(optional)
(required)  
Verification code: Required
   
Add
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED