In .net (in particular, C # really), is there an equivalent Java class DataSource? I'm used to creating a single DataSource (pool or without pooling) and passing it to objects that require creating new database connections. Useful in decoupling / addiction situations.
However, in .net, the SqlConnection instance is created from the pool if you use the same connection string . Does this mean that you have to pass the connection string (or the connection string builder) to the DAO class classes, just bypass one Connection object or create a new ConnectionProvider class like ??
eg,
class SomethingDao { DataSource dataSource; Something getSomething(int id) { connection = dataSource.GetConnection(); connection.CreateCommand(); ... etc } }
source share