Multiple dbml file in One Website
-
-
Hi, I have One Database for Master Tables & Another Database for Transaction Tables. I have Created two .dbml file.I want to write qurey with the combination of both files. Is it possible to write query which links two database using LINQ. Thanks.
It is not possible to define 2 DataContext and create a query that uses tables from both of them.
-
Hi, I have One Database for Master Tables & Another Database for Transaction Tables. I have Created two .dbml file.I want to write qurey with the combination of both files. Is it possible to write query which links two database using LINQ. Thanks.
I think it's possible to use 2 contexts if you are going to perform the the parts of the query that involve both the contexts on the client side. You do parts of the query that involve a context on its server then you do the parts that involve both on the client. This is done by getting entities involved in the joint query in the client's memory and then do query them locally. The ToArray, ToList, AsEnumerable... can be used to force loading entities to memory from the server. But you must be careful of what you load otherwise you'd end up loading so much data in client memory affecting performance and maybe get a nice OutOfMemoryException :) I've just tried AsEnumerable and it works.
Eslam Afifi
modified on Monday, June 22, 2009 9:19 PM