Reputation: 658
I'm planning to do a website where people have to log in to access it. Easy enought. Now, once they log in, depending on information in their membership, I want the website do use a specific database.
So I could have 100 database, with the same structure, but with different data for each specific group of users - Instead of having one large database and determinen which data they can access with an identifier column.
Not sure I'm making sense here. Basically, one website, mutiple websites depending on membership.
Is there a way I can to do this? Is there another approach that would be effecient?
Thanks!!
Upvotes: 1
Views: 159
Reputation: 107247
If I understand correctly, you still have just the one Membership database, and after authentication, thereafter depending on some criteria, your application switches connection string depending on the user, but it is just the one application.
Technically, this isn't particularly challenging, given that all of the common data access mechanisms (Linq2SQL, EntityFramework, SQLClient etc) all allow the connection string to be provided at run time. You could either add 100 connection strings to your web.config, or store them elsewhere (e.g. your initial Membership DB).
However, that said, in the long run you might find it easier to filter data specific based on the user's associations to the data, and just retain the one database.
Consider
etc.
Upvotes: 2