简体   繁体   中英

GraphQL Hotchocolate one schema with EF Core and several databases

We want to create one GraphQL schema using EF Core and Hotchocolate. Our data is in several databases two Azure SQL and one PostgresQL. In the first DB we have descriptive data and in other two real-time pricing data from different data vendors. We need to have one schema where we have a combination of descriptive and pricing information from several data vendors.

What is the best way to configure Hotchocolate server with EF core to get data from those DBs into one schema? It's not a problem to create several schemas but what is the optimal way to have only one without stiching?

Maybe something like this?: https://dejanstojanovic.net/as.net/2020/november/accessing-multiple-databases-from-the-same-dbcontext-in-ef-core/

And then using DbContext in HotChocolate: https://chillicream.com/docs/hotchocolate/v12/integrations/entity-framework

There is also GraphQL Federation which might be overkill for your scenario, I would view it as more of an enterprise thing. But it´s worth checking out: https://www.apollographql.com/docs/federation/#:~:text=Apollo%20Federation%20is%20a%20powerful,subgraph

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM