Is there a way that i can use entity framework to query across multiple data sources as in (mongodb, sql server, oracle) simultaneously. Like for example user accounts and profiles are on a sql server and other data on mongodb for quick access and some other data on oracle. Does EF support querying multiple datasources this way? or is there any other solution that might support such features. Thanks in advance.
Share
No, EntityFramework can’t do that. In fact, it cannot even do queries over two different contexts from one database.
You can write your own abstracting layer above EF which will forward your queries appropriately.
Update: as an afterthought – I don’t think that writing one-DAL-to-rule-them-all is a good idea. Different datasources usually means different concerns, and that means you should separate them as different services. It’s not so convenient at the first glance, but it (usually) pays in the long run.