Is it possible to have an EDM that retrieves data from two data sources at the same time ? Say, it retrieves 3 tables from an SQL Server database and some other data from a binary file ?
2 Answers
No, you'd need one EDMX per data source then use a repository to merge the results in memory.
4 Comments
Attilah
Can you please point me to a link as to how to do this ? especially the results merging in memory.
Chris Snowden
Depends what you need to do but generally you get the results from both database queries and then assign them however you need in memory afterward. If you give a more specific question, we can give a more specific answer.
Attilah
I have a EDM that exposes table1, table2 and table3. now, I have another API which will be used to retrieve data that will be used for table3. what I want is that when the client does this : var tb3 = context.table3.First(); =>it retrieves data from the API, but when he does this : var tb2 = context.table2.First(); => it retrieves data from table2 of the database.
Chris Snowden
You'd need one context per database but can then create a
repository access class that has both contexts to return merged data from both where needed.