- Thomas Rolseth
- SnapDevelop
- Thursday, 17 September 2020 07:35 AM UTC
In a SnapDevelop API solution I am working on, I have the following in my startup.cs that handles the database connection:
services.AddDataContext(m => m.UseOdbc(Configuration["ConnectionStrings:temp"]));
The DSN 'temp' is in my appsettings.json file and my database context class is attached. There could be multiple PowerBuilder clients calling this API that would need to connect to a different database. I'm using ODBC in my example but all of these databases will be SQL Server. If I put a client ID in the request header or pass a client ID to a controller in the url for the RestClient call, how could I use that to switch between connection strings?
Thanks, Tom
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.