我们有一个包含子域的站点,例如:
We have a site which has sub domains like:
并且每个域和子域都有不同的数据库,如下所示:
And each domain and sub domain has a different database, like this:
你尝试过什么?
现在,对于单点登录,我们计划重定向主站点中的用户进行注册.
Right now, for single sign in we have planned to redirect users in our Main Site for signing up.
子域中的订单处理从主数据库中获取 UserID 并存储在相应子域的 Orders 表中.
While order processing in sub domains get the UserID from main DB and store in respective sub domain's Orders table.
出于报告目的,我们将没有 FK 约束
的 UserID
存储在 Orders
表中,因为我们有单独的数据库.
For reporting purposes we store the UserID
without FK constraint
in the Orders
table since we have separate database.
我可以在这里看到 堆栈交换站点有单独的数据库,但它有单独的 用户 表也是吗?
I can see here that stack exchange sites have separate databases, but does it have separate users tables too?
StackExchange Network 配置文件是否存储在单独的数据库中?
我可以从这里看到 每个站点的用户表都有 StackExchange Network 配置文件的 AccountId.
I can see from here that Every site's user table has AccountId of StackExchange Network profile.
示例:
这里是 ID:7598 的 Nick Craver 网络配置文件
Here is Nick Craver Network Profile with ID:7598
他在历史站点中的个人资料的帐户 ID 与相同 ID 关联:7598 检查 this 查询.
His profile in History Site has Account ID Linked with same ID:7598 check this query.
我在数据哑巴中的任何地方都看不到Accounts
表,那么 AccountId
被存储了吗?以及如何使用 AccountId
在多个站点中完成 SSO?
I can't see the Accounts
table anywhere in data dumbs , So Were is AccountId
stored? And how is SSO done in multiple sites using AccountId
?
我的问题:我们是否需要主数据库中的单个用户表,或者我们必须为子域的数据库和Link Main DB UserID
创建单独的用户表,但不需要FK 约束?哪个是购物网站的最佳设计?
My Question: Do we need a single user table in Main DB or we have to create separate user tables for the sub domain's database and Link Main DB UserID
but not FK constraint? Which is the best design for a shopping site?
任何帮助都会很棒.
您提到的 UserID 仅在单个 DB 的特定 Users 表中相同.它实际上不是您域中任何用户的标识符.要识别多个数据库中的用户,您需要为每个用户提供域级 ID.一种简单的方法是将一个名为 UID 或类似名称的属性(列)添加到全局唯一 ID(GUID,请参阅 https://msdn.microsoft.com/en-us/library/system.guid(v=vs.110).aspx) 并将其用作域级 ID 来识别用户而不是 UserId.通过这种方式,您可以自由地将用户信息存储在域中的多个数据库中.所以:
The UserID you mentioned is only identical in a specific Users table in a single DB. It's actually not an identifier of any user in your domain. To identify users across multiple databases, you will need a domain-level ID for every user. A simple way is to add one more property (column) named UID or something like that to User class (table), of Global Unique Id (GUID, see https://msdn.microsoft.com/en-us/library/system.guid(v=vs.110).aspx) and use it as domain-level ID to identify users instead of UserId. This way you can freely store user information in multiple databases in your domain. So:
这篇关于设计用于单点登录的用户表以跨子域使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!