On 10/11/2011 5:46 PM, Adam Ruppe wrote:
Andrei Alexandrescu wrote:
The database engine should be codified in the connection string,
not in the type name.

Why?

If it's in the type, you can trivially specialize for different
engines and get static checking for functions not supported
across them all, or runtime checking if you prefer.

You can also change the constructors to make it clear what
is being created.

Agreed. In addition, if DbConnection handled all connections based on the connection string (of course, we're assuming connection strings are all unique here), then DbConnection would have to be modified to support a new driver.

DbConnection should have the lowest common denominator implementation / abstract routines, and the specialized Connection classes would work from that. That's how ADO.net works at least.

Reply via email to