Re: Class Library Configuration Files
- From: "Brian Gideon" <briangideon@xxxxxxxxx>
- Date: 28 Mar 2007 06:04:56 -0700
On Mar 28, 3:03 am, "Peter Bradley" <pbrad...@xxxxxxxxxx> wrote:
OK. A bit behind the times, I know; but we're just moving over to .NET 2.0.
How on earth do you manage configuration settings in a class library in .NET
2.0? In version 1.1, we used a handy class called AssemblySettings that
someone (I forget his name) had written. When the class library was
finished, you deployed it to the GAC and put the configuration files in the
GAC with the class library assembly. This no longer works. In fact trying
to get configuration data from anywhere but the calling executable falls
over.
This can't be correct. Our n-Tier architecture uses class libraries to
access data from the database and needs to obtain a connection string from a
configuration file. It's no good putting the configuration in the calling
executable because the calling executable does not know anything about the
database, and anyway the whole point of a class library is that it can be
called by many other objects. We don't want the same configuration data
spread all over the place.
Surely there's a way to fix this. Does anyone know how?
Peter (spitting blood and calling Microsoft all sorts of things you don't
want to hear)
There's another school of thought that says you should keep
configuration parameters out of the class library precisely because it
can be reused by multiple applications. Different applications might,
and often do, need to inject different parameters.
There are certainly cases where it makes sense to have a class libary
specific configuration file. I'm just not convinced this one of
them. And unfortunately I don't have an answer to your specific
question.
Brian
.
- Follow-Ups:
- Re: Class Library Configuration Files
- From: Peter Bradley
- Re: Class Library Configuration Files
- References:
- Class Library Configuration Files
- From: Peter Bradley
- Class Library Configuration Files
- Prev by Date: How to use MDI Child forms with a Docking toolbar
- Next by Date: Re: sealed methods, why need to include the override modifier?
- Previous by thread: Class Library Configuration Files
- Next by thread: Re: Class Library Configuration Files
- Index(es):
Relevant Pages
|