views:

37

answers:

1

Hi all

Those configuration files sure can bloat as you add components to your web project. NHibernate, Castle, log4net - they all want a slice of that action.

Instinctively I tend to prefer hardcoded configuration (assuming of course the config data won't change much) - a la Fluent NHibernate. I kind of fear that if the config file becomes large, accessing data off it will slow down, to the application's detriment. I also tend to think that data in compiled code will be faster to access than data in an external file.

I am right in thinking this?

Also, how does it work? Is the config file parsed and loaded into memory the first time it is accessed? Is any subsequent access as fast as other types of in-memory access, like (say) accessing a local variable?

Thanks for any info.

David

+1  A: 

If you are in a web application then asp.net does monitor the config file and reload it if it changes but desktop apps typically do not. But you can easily add a file watcher to the file to accomplish this.

But if your files are getting too big one thing to consider is splitting the file into multiple files. Scott Allen has a good article here about this: http://odetocode.com/Articles/418.aspx

spinon