I'm having the following scenario: I'm working on a multi-tenant application that requires to redirect Database operations to each client DB. So when a user connects to the application, the system uses that client DB to process his actions and operations.
I decided to use the default MVC 4 - SimpleMemberShip provider to handle Membership operations, however, I'm facing the problem that "WebSecurity.InitializeDatabaseConnection method can be called only once".
Thus, I'm trap on using one single DB for all users of the system, even if they have their own Database with SimpleMemberShip tables created on them.
So I'm wondering, Is there a way to either reconnect WebSecutiry.Login each time for SimpleMemberShip, or to dynamically change the DB connection so it goes to the proper client DB to validate user credentials?
Something like:
WebSecurity. <ChangeConnection> or <ReinitConnection>
bool result = WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe)