Entity Framework (Core) Query Multiple Tables From 2 Different Databases

entity-framework entity-framework-core

Question

How can I write a query to get data from 2 (or more) tables from different databases with EF Core? I have now the following code:

var items = (
    from o in _db1.Orders
    join c in _db2.Customers on o.CustomerId equals c.CustomerId
    where c.CustomerId = 1
    select c;
).ToList();

In MySql I have this query that needs to be transformed to the expression above (Linq).

SELECT c.* 
FROM db1.Customers c
   JOIN db2.Orders o ON c.CustomerId = o.CustomerId 
WHERE c.CustomerId = 1;

Please help

1
0
12/18/2016 5:05:04 AM

Accepted Answer

This scenario is not supported as of today and there are no plans to support it

This and other related features are mentioned at the end of this EF Core issue

0
12/17/2016 8:21:57 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow