Select database at runtime


  • I have the same model implemented in SQL Server and SQL Compact.

    Depending on a switch in the config file, I want to select one of the databases at runtime.

    What is the best way to get this working?


    Thanks in advance,



    Saturday, August 16, 2008 12:42 PM


  • Please take a look at


    It uses the common model (CSDL) and targets multiple databases (one SSDL file for each). Mapping (MSL) is shared, because table and column names are the same, but you can also have different mappings for each target database.


    Once you've prepared SSDL for each backend, you have to define multiple connection strings - one for each backend. See App.config in the sample project for details.


    Let me know if it helps.

    Saturday, August 16, 2008 6:45 PM