querying databases on same server with linq

Posted by geoff swartz on Stack Overflow See other posts from Stack Overflow or by geoff swartz
Published on 2010-04-14T12:46:44Z Indexed on 2010/04/14 12:53 UTC
Read the original article Hit count: 258

Filed under:
|

In normal sql I could do joins on tables in different databases as long as they were on the same server (or linked servers). In linq I can't figure out how to do that. Is this possible? For example, if I have a database called db1 and another called db2. db1 has a table called people and db2 has a table called address I could do something like...

select a.addressline1, p.firstname
from db1.dbo.people p
inner join db2.dbo.address a on p.peopleid = a.peopleid

Is this possible with linq? Thanks.

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about inner-join