home & news
DSL DevCon
interviews
tools
the spout
writing
fun
colophon
contact
off topic

Google

 

The Last Configuration Handler I'll Ever Need

I'm sure someone, somewhere has already written this, but I figured it out on my own today, and it's just too cool not to share. Basically, it's a bit of code that lets me store objects in my application or web configuration file, and all I have to do is write the type that holds the values.

Craig Andera , Saturday, February 22, 2003 10:26 AM

Very elegant -- I like it! This is one of those things where you slap yourself on the head and say "of course!"

Michael Bouck, Saturday, February 22, 2003 12:24 PM

Thanks! I thought so too. That's why I said, "I'm sure someone must have written this already..." :)

Craig Andera, Saturday, February 22, 2003 6:08 PM

A friend of mine built NetReflector, which is similar. I thought some of you might find it useful.

http://sourceforge.net/projects/netreflector/

Kim Gräsman, Monday, February 24, 2003 10:37 AM

That's cool, Craig. Does it come with a utility that tells you the format of the XML to put into the .config for your custom type?

Chris Sells, Monday, February 24, 2003 4:14 PM

Geez, Chris, what do you want from me? :)

I'll see what I can whip up.

Craig Andera, Wednesday, February 26, 2003 10:33 PM

I didn't have time to explore what it would take to spit out example XML given an arbitrary type, so I thought of a cheesy way to do it. It's based on the fact that ASMX web services use the same XML serialization engine that I do.

* Write the type you want to store.
* Write a simple ASMX web service that has one method that has a single input parameter of that type.
* Navigate to the ASMX-generated HTML page for the web service, and click on the link for that operation.
* Go look in the sample SOAP message - you should see your type expressed as XML.
* Cut and paste into your config file, adding the "type" attribute.

How's that, Chris?

Craig Andera, Thursday, February 27, 2003 9:57 AM

How do you extend this solution to incorporate repetitive items?
i.e
(Foo name=”A”)1.234(/Foo)
(Foo name=”B”)5.678(/Foo)

Marlo, Monday, March 31, 2003 5:34 PM


 Reply to this news

Marquee de Sells

  home & news   DSL DevCon   interviews   tools   the spout   writing   fun   colophon   news  contact  off topic 

Ads: text links  build a website  best web hosting  White Noise  Web Optimization  VMOptions Web Directory  free software downloads  termite control  recommendation software  Web Hosting Reviews  payday loans  Internet Marketing Software  Authority Web Directory  buy backlinks  Bathrooms  Online Tutoring Jobs  thermal paper  lead management 

This page is copyright (c) 1995-2009, Chris Sells. All rights reserved. No warranties extended. Some assembly required. Void where prohibited. You may link to this site freely from your own site. You may quote small excerpts from this site, but please include a link to the original source on this site.