Question

I'm in the process up changing a single SQL DB website (ASP.NET/VB.NET) into a multitenant app, where each client has their own database.

In the old site, all the ASP roles, logins and providers pointed to the single database.

Now we have multiple databases, I'm wondering what would the best architecture/techniques to use. There is one database that configures the tenants, such as the company name, various settings (that would normally be in a web.config) and the connection string to their tenant database.

Should we have all the membership & role stuff in the single database that configures the tenants or do we have membership & roles in each individual tenants database? Option 2 seems tricky because I think ASP.NET only likes one set of RoleProviders defined in the web.config.

Has anyone tried this before or got any recommendations?

Was it helpful?

Solution

If you're using the ASP.Net Membership model with the built-in providers' then putting them into one DB is the easiest as you indicated.

One option, and I've not tried this, is to define in your web.config file a provider for each tenant. This would allow each tenant to have their own membership db, and allow you to avoid username collisions between the tenants (if this is a requirement).

OTHER TIPS

You should be able to configure the the ASP.NET membership database connection string at runtime. This thread has a few options including a custom membership provider or changing the value early on in the request lifecycle via Global.asax.cs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top