The best way to get close to this is to use the interfaces provided by database providers; they are almost parallel to functionality. Create a static factory class to create interfaces for command adapters, data adapters, and connections based on a customized database. For instance:
public static IDbDataAdapter GetDataAdapter (Database db) { switch (db) { default: case "MsSql": return new SqlDataAdapter (); case "MySql" return new MySqlDataAdapter (); } } public static IDbCommand GetCommand (Database db) { switch (db) { default: case "MsSql": return new SqlCommand (); case "MySql" return new MySqlCommand (); } }
Your client code will not know the difference, although it will need to pass a configuration string. Use VS docs to learn the interfaces given by each of the objects that you usually use, and stick to them and it will be quite simple - although you may have to hack your way through a couple of things.
moomi source share