XML file vs. DLL?

B

Brett Romero

I'd like feedback on using an app.config file to store static
information such as company name, database name, etc. then use a DLL to
load it. I want to put everything into enumerators. This is a winform
app. I'd like to avoid having to create an instance to access this
information. In other words, using only static methods.

The DLL allows me do any related additional processing specific to only
the static info. This seperates the static information from the
application and keeps it from attaching itself to one of the winforms
via instantiation. In other words, the winform app will use a non form
class as its startup object. The non form class will call the DLL, do
any additional processing, and load the first form. Does any one see
problems doing this?

XML or config file:
Will I need to load from the config file everytime since the methods
are static? Example?

Thanks,
Brett
 
N

Nicholas Paldino [.NET/C# MVP]

Brett,

I would look into creating a configuration provider. Basically, you can
place your XML configuration in the .config file for the app, and then that
information would be provided through the classes in the
System.Configuration namespace.

Check out this article on developer.com titled "Using Application
Configuration File in .NET", located at (watch for line wrap):

http://www.developer.com/net/net/article.php/3396111

This should give you the information you need to create your own
configuration handler.

Hope this helps.
 
B

Brett Romero

Yes, and I was doing that before. However, as you can see in the
example, he must provide a hard coded string reference to keys in the
file. Now, if those keys change, he's stuck. That's why I want a
combination of the configuration provider and DLL. The DLL will load
the enumerators from the file. Then I'd like to statically access the
enumerators. This keeps the app from having to know anything about the
file except in the initial startup non form class.

Brett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top