Connection Strings and Configuration Files
Sometimes you might see a variation of the service provider design that provides its connection string as a property or requires the connection string in its constructor. This design might seem like a good idea because it allows flexibility for the data access class to be used with different data sources or login information. However, this approach also creates its share of problems:
It introduces one more area in which the component will be susceptible to client mistakes.
It introduces one more area where security can be compromised because each client will need to know the database user ID and password.
It can threaten connection pooling because minor changes in the connection string result in the creation ...