Doing something weird here. For sake of security, the project manager wants this ASP.Net MVC web app to use separate databases for each client. I already know that I’m going to be using the overload for the DataContext class that accepts a connection string as an argument to “hotswap” to another DB. The problem I’m facing is I know I don’t want to write this logic in each and every action, to read in the first parameter of the URL (which in this case will be the client’s name) and choose their database to build the DataContext against.
So .. How can I grab this data and somehow rig it up to create the DataContext is the Controller’s Constructor using some value to connect to the right database?
I’m hoping this makes sense. More details — Web App will run for multiple clients, and each client will have their own DataBase with Vendors, Items, Settings, etc… I’m really not sure what data is relevant here. 😛 Please forgive me!
EDIT: Why the downvotes? If I’m approaching something the wrong way … can you give me a hint?
Looks like I’m going to push back and explain this is a huge issue for scalability, and instead will use a
Clientcolumn to differentiate different datasets.Thanks for all your input!