I am in the process of creating a Multi-Tenant asp.net application.
I am deciding between separate MSSQL databases or schemas.
However, I cannot find any information on how I can change the database (ideally) or user account dynamically, depending on which one the user should connect to.
I will most likely have a Base Table which defines which database the user should connect to.
Doing this using Linq to SQL is easy but I am not using Linq everywhere because the tables are quite dynamic and the schema is like to change very often.
What is the best method of doing this? I am happy to look at using Schemas, but I don't want it to become very messy but I would also need to do a similar approach but somehow impersonate that user in the same way to pickup a default schema.
I know you can dynamically change the web.config connection string but I have tried that and it physically changes the file contents which also refreshes the app pool and causes me lots of other issues.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…