Search code examples
linq-to-sqlmultiple-databases

Tables from two different databases in a DBML?


After dragging two tables in from one database, I switch to another and drag a table in. Now I get a message if I want to replace the connection string with the new one. I want tables from multiple databases in one DBML. Is this possible?


Solution

  • I don't believe that what you're looking for is possible, since the DataContext would then not have any easy way of resolving results from two separate databases.

    If you're looking to create domain objects from two separate databases, then your best bet would be to have two separate DBML's, then use a bridge (GOF) or some other related design pattern to instantiate your domain objects.