It’s possible to perform joins across different databases using LINQ? If yes then how?
It’s possible to perform joins across different databases using LINQ? If yes then how?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes and no. A single linq query against L2S or L2E will be sent as one query down to the database. That said, ff you are joining tables that exist in separate databases you can:
a) Run separate L2S/L2E queries against the two databases, and join the results client-side in a linq-to-objects query.
…or…
b) Use linked tables or views in the database to access tables in another database.
…or…
c) If the tables are in separate databases on the same machine and you’re using Linq-to-SQL, and the login credentials you are using are allowed to access both databases, you can add the database name as a prefix in the dbml file. The generated queries will then target the right db.