The setting file was originally compiled as an Embedded Resource XML document
in the project, but the need to change settings without redistributing the
DLL arose and now the settings are contained in a SQL table (about 40 values
loaded into a string array).
If it was simply loading the embedded XML document every time I wouldn’t be
nearly as concerned as I am about making repetitive connections to SQL to get
the information.
Say for example a programmer request the use of a method in the DLL. This
method will then access the DLLs database to pull some information it might
need. For simplistic sake lets say this method is contained within the
[Utility.Token] namespace. During the process of this method, an error
occurs. This triggers the stack trace to get handed off to another method in
the SAME DLL but a different namespace [Utility.Errors]. Because all the
setting information is not retained across classes or namespaces, I have to
connect to SQL again to reload the information to process the error that
occurred. Now I potentially have two open database connections (depending on
when I disposed of the first) for information I’ve already loaded once.
I had pondered passing the string array with the settings from method to
method, however, because these methods are used both externally by other
programmers and internally by other classes in the DLL, the programmer in
particular would have no idea how to get (or what) the string[] is.
If I could load an array once when the DLL is loaded (something similar to
Application_Start() (but for a DLL) then I could load a string array and have
it be visible to all objects in the DLL regardless of namespace or class
that’s trying to use it.
Hope this makes since
--
JP
..NET Software Developer
"sloan" wrote:
You might want to look at:
New! StockTrader 2.02 with Configuration Service Source Code
http://msdn.microsoft.com/en-us/netf.../bb499684.aspx
Greg wrote a "mini configuration framework" piece.
Its NOT super trivial.
Are the settings COMPILED into the dll? Or is the dll a wrapper to read
settings from the database? (and subject to change within the db)?
Can you fill in a few areas of your description of what you're doing now.
"JP" <JP@discussions.microsoft.comwrote in message
news:4C**********************************@microsof t.com...
I have a C# DLL project I have created. The DLL plugs into other C#.NET
applications. This DLL has several classes and methods comprised for 4
namespaces that are used by other programmer to perform common tasks.
The settings for this DLL are contained within a SQL a database for easy
modification. The issue I am having is the number of times the DLL has to
make connections to the database to retrieve the settings information
because
the call is in a different class or namespace from the previous call.
Ive have tried whenever possible to get the settings information at the
class level rather then the method level so that all methods in the class
can
use the same values. However, because these classes are also used by other
methods WITHIN the same DLL, the number of times needed to retrieve
information from SQL continues to grow.
Is there any type of Global access in DLL project that would allow be to
load information one time and have its values accessible to any namespace
or
class in the project?
--
JP
.NET Software Developer