多租户问题 [英] Multi-tenancy question

查看:83
本文介绍了多租户问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过
http://msdn.microsoft.com/ en-us / library / aa479086.aspx
 以及多租户应用程序的不同选项的概念对我来说很清楚。我将开发的应用程序(.NET Web应用程序)将使用共享数据库/共享架构模式。因此,我将使用带有TenantID的Tenant表的
,该TenantID将添加到我的db的每个表中。这就是我被困住的地方:Tenant表中应该有哪些列?我想Tenant表至少应该有:ID,TenantID,UserID,Url,......?我可以想象当有人登录webapp时我需要
UserID才能找到正确的TenantID?对于Url来说,找到TenantID一样吗?在我的情况下,租户是客户,因此我认为所有相关的客户信息都应该放在单独的客户表中,而不是在租户表中添加
列?

是否有一些示例租户表设计?


谢谢。


 

解决方案

< blockquote>

您的会员系统应该有一个与每个用户相关联的customerid。 此外,还有人在每个客户处分配为添加员工的超级用户。


租户表中应包含客户ID和公司名称地址数据。 客户ID将是您的会员系统的用户表中的外键, 


您的所有表中都需要customerid,您应该考虑编写强制执行此要求的视图并保护表以便必须通过视图进行网络访问。


出于安全考虑,最好使用GUID或其他东西作为customerid,并且不要在外部发布。 因此,试图破解的人将无法计算表格结构,并且必须猜测GUID以获取任何数据。 
您可能因此需要customerguid和customerid。 通信显示了customerid,但内部总是使用guid。


希望这会有所帮助。


 


I read the article http://msdn.microsoft.com/en-us/library/aa479086.aspx and the concepts of the different options for multi-tenant apps are clear to me. The application I'll develop (a .NET web app) will use the shared database/shared schema pattern. So I'll make use of a Tenant table with a TenantID that will be added to every table of my db. And here's where I'm stuck: what columns should be in the Tenant table? I suppose the Tenant table should have at least: ID, TenantID, UserID, Url, ...? I can imagine that I need the UserID to find the correct TenantID when someone logs-in the webapp? The same for Url, to find the TenantID? A Tenant is in my case a customer, therefore I suppose all related customer info should go in a separate Customer table instead of adding columns in the Tenant table?
Are there maybe some examples of a Tenant table design?

Thanks.

 

解决方案

Your membership system should have a customerid associated with each user.  Plus someone allocated at each customer as a super user who adds their employees.

A tenant table should have customer id, and company name address data in it.  Customer id would be a foreign key in the user table of your membership system, 

All your tables need customerid in them and you should consider writing views that enforce this requirement and securing tables so web access is necessarilly via the views.

For security reasons it's also best if you use a GUID or something as customerid and don't publish this externally.  Thus someone trying to hack won't be able to work out table structures and would have to guess a GUID in order to get at any data.  You might therefore want a customerguid and a customerid.  Correspondence shows the customerid but internally the guid is always used.

Hope this helps.

 


这篇关于多租户问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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