# Thursday, January 31, 2008
« Preparing for Doppler v4 Iteration 1 | Main | Doppler Project : Progress So Far »

I have been busy this week creating our company's subscription service, more on that later.

As part of this I am integrating with PayPal to enable recurring payments.  The PayPal service has a number of configuration options to work with, merchant IDs, IPN handler locations, PDT handler locations, API locations etc.

I started writing my own configuration section handler for PayPal and became bored writing the properties, so I came up with these templates for CodeRush.  We all need something to relieve the boredom of repetitive tasks: -

Template Name : scp

[ConfigurationProperty("«Caret»«FieldStart(Setting Name)»«Link(settingName)»«FieldEnd»", «Field(Optional, OptionalSettings)»)]
public object «Field(Setting, Setting Name)»
{
    get {return base["«Link(settingName)»"];}
    set {base["«Link(settingName)»"] = value;}
}«Target»

Template Name : scp?Type?

[ConfigurationProperty("«Caret»«FieldStart(Setting Name)»«Link(settingName)»«FieldEnd»«BlockAnchor»", «Field(Optional, OptionalSettings)»)]
public «TypeLink("«?Get(Type)»")» «Field(Setting, Setting Name)»
{
    get {return («TypeLink("«?Get(Type)»")»)base["«Link(settingName)»"];}
    set {base["«Link(settingName)»"] = value;}
}«Target»

Typing scps<space> will expand with the following results: -

[ConfigurationProperty("settingName", Optional)]
public string Setting
{
    get {return (string)base["settingName"];}
    set {base["settingName"] = value;}
}

Typing scp<space> will expand with the following results: -

[ConfigurationProperty("settingName", Optional)]
public object Setting
{
    get {return base["settingName"];}
    set {base["settingName"] = value;}
}

In both cases the "settingName" string will be linked, changing one will change all.  Also the first "settingName" will be highlighted.  Once you are done changing this string hitting <enter> will take you to and highlight Optional, hitting <enter> again once you are done with the optional values will place your cursor after the }.  In the case of scps both of the string types will be linked, changing one will change both.

If anyone is interested in understanding these templates in more detail please let me know.

Thursday, January 31, 2008 5:04:57 PM UTC  #    Disclaimer  |  Comments [1]  |  Related posts:

Monday, May 24, 2010 6:25:40 AM UTC
great article
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview