T
Tom
In a web-application I need to read some configuration from a database.
I like to write a configuration class which will be implemented as
thread-safe singleton.
I connect through ODBC to the database. So to be able to do that I need
to pass the Datasource Name.
How can I create a singleton that has a constructor with a parameter?
Standard singleton pattern always use the default constructor. To
provide an init(string datasource_name) method is no real fun, since the
state of the singleton instance needed to be checked whenever used.
Is there any better solution to this?
Tom
I like to write a configuration class which will be implemented as
thread-safe singleton.
I connect through ODBC to the database. So to be able to do that I need
to pass the Datasource Name.
How can I create a singleton that has a constructor with a parameter?
Standard singleton pattern always use the default constructor. To
provide an init(string datasource_name) method is no real fun, since the
state of the singleton instance needed to be checked whenever used.
Is there any better solution to this?
Tom