将单个DB ASP.NET网站转换为MultiTenant-成员资格和角色困境 [英] Converting Single DB ASP.NET Site into MultiTenant - Membership and Roles Dilemma

查看:82
本文介绍了将单个DB ASP.NET网站转换为MultiTenant-成员资格和角色困境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将单个SQL DB网站(ASP.NET/VB.NET)更改为多租户应用程序,每个客户端都拥有自己的数据库.

在旧站点中,所有ASP角色,登录名和提供程序都指向单个数据库.

现在我们有多个数据库,我想知道最好使用哪种架构/技术.有一个数据库可以配置租户,例如公司名称,各种设置(通常在web.config中)以及到其租户数据库的连接字符串.

我们应该拥有所有成员资格吗?配置租户的单个数据库中的角色角色,或者我们是否具有成员资格&每个租户数据库中的角色?选项2似乎很棘手,因为我认为ASP.NET只喜欢web.config中定义的一组RoleProvider.

有没有人尝试过这个或有任何建议?

解决方案

如果您将ASP.Net成员资格模型与内置提供程序一起使用,则按照您的指示将它们放入一个数据库是最简单的.

一个选项(我没有尝试过)是在web.config文件中为每个租户定义一个提供程序.这样,每个租户都可以拥有自己的成员数据库,并可以避免租户之间的用户名冲突(如果这是必需的话).

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?

解决方案

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

这篇关于将单个DB ASP.NET网站转换为MultiTenant-成员资格和角色困境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆