Converting Single DB ASP.NET Site into MultiTenant - Membership and Roles Dilemma
Asked Answered
D

2

3

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?

Deadbeat answered 27/1, 2009 at 13:39 Comment(0)
C
2

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).

Cannell answered 27/1, 2009 at 13:45 Comment(0)
A
0

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.

Anjanetteanjela answered 9/8, 2013 at 0:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.