C
C#2y ago
stayclaxxy

❔ EFCore in .net 6 Web API - using same context/model for multiple environments simultaniously.

I am trying to write a Web API, one of the GET methods in a controller needs to return data from the same table, but in multiple environments. All of the envrionments' schemas are the same (except login credentials/connection string). I was wondering if there is a way to use the same context and table model class to query all 3 environments with EFCore for the sake of keeping the code dry and clean. TIA
3 Replies
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Oops
Oops2y ago
Did you figure out an answer to this? You should be able to use the same classes and just change your connection string per environment in your Startup/Program.cs when registering the dbcontext
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server