Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App.Config or XAML

I am currently evaluating my options for a rewrite of the projects I'm working on and I am a bit miffed by the stringly-typed nature of our app.config files.

I'd like to move to a more structured approach, so I have two options:

  • Use custom SectionHandlers in the app.config
  • Scrap app.config and use XAML instead.

I'd like to get your opinions and horror stories on this, what are the pros and cons of using XAML for this?

Cheers, Florian

like image 465
Florian Doyon Avatar asked May 21 '10 08:05

Florian Doyon


2 Answers

If we are talking about config files I would use the app.config? Why? That's what it's meant for. If we are talking about resources (pictures, messages) I would put them in a XAML resource directory.

There is a guideline available on the web on where to put what, but was still in draft last time I checked and doesn't mention app.config afaik.

But do what works best for you :)

like image 176
Snake Avatar answered Nov 15 '22 04:11

Snake


In terms of development effort is 6 of one half a dozen of the other.

If you use Xaml you will need to create a set of classes instances of which the Xaml will create.

If you using Custom SectionHandlers you will still need to create classes instances of which these sections will represent. You also need to create the SectionHandlers as well.

1 - 0 to Xaml.

In the case of Xaml though you will need to provide your own infrastucture to load the xaml at startup and access the configuration throughout your app.

On the other hand using Section Handlers the existing .NET ConfigurationManager provides the infrastrucure to access these.

1 all

like image 29
AnthonyWJones Avatar answered Nov 15 '22 04:11

AnthonyWJones