I am using C# and I need to have dynamic contexts meaning. lets say i have scaffolded on db1 and users dB, after user logins I take connection string of db2 from users dB and now i want to use db2 instead of db1. the models of db1 and db2 are exactly the same. there are more than 20 db with same models which need to change dynamically. How do i achieve this so i can use LINQ on db2 context and also there are lot of different query's running though I cant create and dispose of context for db2 every time. Also to keep in mind this DB is in postgres sql
I wanted to try just by saving created contexts in he same class but i think not disposing of them and can cause problems