I have a connectiong string, it may be for an MS SQL DB or it may be for Oracle. I’m thinking of writing a ConnectionFactory that takes the string and returns an IDbConnection thus abstracting my code away from the concrete implementation, but does this or something that achieves the same thing already exist?
Share
I believe you’re thinking of a DbProviderFactory
EDIT: Using the ProviderFactory, you can store the provider right with the connection string. (from the link above):
EDIT 2: If config files are truly out of the question, it would be possible to write your own ProviderFactory class that parses the Connection String Syntax and gives back the appropriate DbConnection object.