R
Rob Meade
Hi all,
Ok - I'm going around in circles and would appreciate some help.
I have written a windows service, which up until I tried to be clever was
working well
)
I have a main class which inherits a base class, I also have a
"configuration" class which stores a load of values read in from an xml file
which I would like to be available at any time (without reading the xml file
again).
My intention was to add my "ApplicationConfiguration.vb" class as an object
in my base class, thus everything that derives from it gets to see the
settings.
My problem being that I have some code in the base class that I would also
like to use in the application configuration class - is only one function
but it writes to the event log and I dont see the point of doubling this
up...
This is where the problem began - I decided it would be best for the
application configuration class to inherited the base class - whooops - and
there we go - .net endless circling and creating more and more instances of
itself until it overflowed....luckily in vs2005 it catches this kinda
stupidity before it happens (2003 didnt!!)...
So, I've now removed the inheritance in the application configuration class,
but I'm left without the function I need...
Can anyone offer me any solutions? A "singleton" was suggested by a
colleague at work, but I hadn't fully explained the problem so I wasn't sure
if that was the way to go - plus I only have a rough idea of what a
singleton is so I'll probably code it all wrong anyway
Any help appreciated,
Rob
Ok - I'm going around in circles and would appreciate some help.
I have written a windows service, which up until I tried to be clever was
working well
I have a main class which inherits a base class, I also have a
"configuration" class which stores a load of values read in from an xml file
which I would like to be available at any time (without reading the xml file
again).
My intention was to add my "ApplicationConfiguration.vb" class as an object
in my base class, thus everything that derives from it gets to see the
settings.
My problem being that I have some code in the base class that I would also
like to use in the application configuration class - is only one function
but it writes to the event log and I dont see the point of doubling this
up...
This is where the problem began - I decided it would be best for the
application configuration class to inherited the base class - whooops - and
there we go - .net endless circling and creating more and more instances of
itself until it overflowed....luckily in vs2005 it catches this kinda
stupidity before it happens (2003 didnt!!)...
So, I've now removed the inheritance in the application configuration class,
but I'm left without the function I need...
Can anyone offer me any solutions? A "singleton" was suggested by a
colleague at work, but I hadn't fully explained the problem so I wasn't sure
if that was the way to go - plus I only have a rough idea of what a
singleton is so I'll probably code it all wrong anyway
Any help appreciated,
Rob