Monday, March 26, 2012

Singleton Usuage

Hi everybody ,
A Couple of weeks back I had asked some practicle
scenarios for using the sigleton pattern.
Most people use the singleton pattern for storing
configuration related data .
Would this not make it difficult to update the cofig data
as the webserver would have to be restarted if there is a
change in the config file.

Regards,
SromoHi,

> Would this not make it difficult to update the cofig data
> as the webserver would have to be restarted if there is a
> change in the config file.

Not the webserver - only the Web application I suppose. And you could
probably employ the FileSystemWatcher object to monitor changes in the
configuration file and reload it if necessary.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Srini" <rsrinivasanhome@.yahoo.com> wrote in message
news:07e501c3992d$6d43be00$a301280a@.phx.gbl...
> Hi everybody ,
> A Couple of weeks back I had asked some practicle
> scenarios for using the sigleton pattern.
> Most people use the singleton pattern for storing
> configuration related data .
> Would this not make it difficult to update the cofig data
> as the webserver would have to be restarted if there is a
> change in the config file.
> Regards,
> Sromo
Yes, use a FileSystemWatcher and make sure you update your singleton
threadsafe ...

"Dmitriy Lapshin [C# / .NET MVP]" <x-code@.no-spam-please.hotpop.com> wrote
in message news:evawFdTmDHA.1284@.TK2MSFTNGP09.phx.gbl...
> Hi,
> > Would this not make it difficult to update the cofig data
> > as the webserver would have to be restarted if there is a
> > change in the config file.
> Not the webserver - only the Web application I suppose. And you could
> probably employ the FileSystemWatcher object to monitor changes in the
> configuration file and reload it if necessary.
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
> http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
> "Srini" <rsrinivasanhome@.yahoo.com> wrote in message
> news:07e501c3992d$6d43be00$a301280a@.phx.gbl...
> > Hi everybody ,
> > A Couple of weeks back I had asked some practicle
> > scenarios for using the sigleton pattern.
> > Most people use the singleton pattern for storing
> > configuration related data .
> > Would this not make it difficult to update the cofig data
> > as the webserver would have to be restarted if there is a
> > change in the config file.
> > Regards,
> > Sromo

0 comments:

Post a Comment