views:

154

answers:

2

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?

+1  A: 

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.

Josh E
A: 

Another option is to create a server link on on database that points to the other and make aliases to the remote tables from the "local" DB. I believe then you'd be able to reference them as if they were all in the same database.

Mike Brown
while this is a technically correct answer, wouldn't this be a poor practice to follow? I've had to deal with linked servers in the past, and in my experience, it hasn't been pretty in terms of maintainability or performance
Josh E