How can i have multi database provider ? RRS feed

  • Question

  • Hi,

    i'm using C# (WPF) in visual studio 2010 ...

    i want write a application that normal users make daily record in databse, for this normal users, i need embedded database like "SQL Compact", and for special user that merge normal users records, i need a faster database like "MS SQL" or "MySQL".

    and now, any idea how to have ability to changing between database system (like : SQL Compact, MS SQL, MySQL or ...) in my application ?

    ps: sorry for bad english ^_^
    Monday, February 15, 2010 7:27 AM


  • > any idea how to have ability to changing between database system 

    The usual answer to this problem is to use data access libraries that have specific support for this.

    A "big" one is the ADO.NET Entity Framework:

    Another, that lets you work closer to the core ADO.NET functionality that you are already familiar with, is the Data Access Application Block that is a part of Enterprise Library:

    There are also popular third party / open source libraries, such as NHibernate (

    Alternatively, you could "roll your own", perhaps by taking advantage of the ADO.NET base classes such as DbConnection, DbCommand, and DbDataAdapter so that you can share the same code for the various provider types such as SqlConnection and MySqlConnection.  Take a look at Enterprise Library (at least for ideas) before going down this route.
    • Marked as answer by WUAmin Tuesday, February 16, 2010 8:56 AM
    Tuesday, February 16, 2010 12:02 AM

All replies