5

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 2

5

short answer: no

You could link database servers within your edmx main database and write views or stored procedures that access the data from the linked server tables.

Sign up to request clarification or add additional context in comments.

Comments

3

No, you'd need one EDMX per data source then use a repository to merge the results in memory.

4 Comments

Can you please point me to a link as to how to do this ? especially the results merging in memory.
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.
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.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.