SQL数据库设计建议:命名数据库表

发布于 2024-08-17 12:55:47 字数 221 浏览 2 评论 0原文

我必须创建一个表并存储代表用户Active Directory SID

您如何命名代表用户和组的类别?

编辑 1.

表将包含四列:ID ( PK )、SID 名称、SID 值和 SID 类型的另一列(0 表示用户,1 表示组)。
请建议表名称,而不仅仅是列名称。

I have to create a table and store Active Directory SIDs representing an User or a Group.

How would you name the category representing both an User and a Group ?

Edit 1.

Table will contain four columns : ID ( PK ), SID's Name, SID's value and another column for SID's Type ( 0 for User, 1 for Group ).
Please suggest the table name, not only the columns names.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

九厘米的零° 2024-08-24 12:55:47

Active Directory 对两者使用术语“主体”或“安全主体”。这也包括计算机。

以下是 MSDN 文章 在 .NET Framework 3.5 中管理目录安全主体的图片 显示层次结构。

替代文本
(来源:microsoft.com)< /sub>

因此,我可能会调用我的表 Principals 并包含您提到的三列:

  • PrincipalName(字符串)
  • SID(字符串或二进制)
  • PrincipalType(0 表示用户,1 表示组)

Active Directory uses the term "principal" or "security principal" for both. That also includes computers.

Here's a grahpic image from the MSDN article Managing Directory Security Principals in the .NET Framework 3.5 that shows the hierarchy.

alt text
(source: microsoft.com)

So I would probably call my table Principals and have the three columns you mentioned:

  • PrincipalName (string)
  • SID (string or binary)
  • PrincipalType (0 for User, 1 for Group)
月棠 2024-08-24 12:55:47

从最详细到最简单:

  • ActiveDirectorySecurityIdentifiers
  • ActiveDirectorySIDs
  • ADSIDs

良好的做​​法规定表名称应该是复数,并且名称应该代表和描述表的内容。根据您的舒适程度,上述任何一项都应该可以。

From most verbose to least:

  • ActiveDirectorySecurityIdentifiers
  • ActiveDirectorySIDs
  • ADSIDs

Good practices dictate that table names be plural and that the names should represent and describe the contents of the tables. Depending on your level of comfort any one of the above should do just fine.

我们的影子 2024-08-24 12:55:47

当我最近不得不执行此操作(将数据库用户表链接到 AD 帐户)时,我只是将列命名为 ADSID。

我发现这对我们来说很有意义,因为我们使用 DirectorySearcher 进行查询,并且 LDAP 数据库中该属性的名称是 objectSid,因此我们的查询如下所示:

deSearch.Filter = "(&(objectSid=" + ADSID + "))";

虽然,当我从项目中剪切粘贴该代码时,我确实想知道是否也许 objectSid 也是一个不错的列名?

至于命名表,我希望您在此处存储 AD 详细信息之外的其他信息?否则,为什么要复制 AD 数据库?

如果您要存储附加信息,那么您应该根据表建模的任何域/业务对象来命名表。

正如我所说,我正在为用户存储数据,因此我的表简称为[Users]。

最后 - 也许您会受益于将其标准化为 [组] 和 [用户] 表?

When I recently had to do this (linking a DB user table to the AD accounts) I simply named the column ADSID.

I found this made good sense for us since we were querying using DirectorySearcher and the name for that property in the LDAP database is objectSid, so our queries looked like:

deSearch.Filter = "(&(objectSid=" + ADSID + "))";

Although, as I cut an paste that code from my project, I do wonder if maybe objectSid would have been a good column name too?

As far as naming the table, I hope you are storing additional information beyond the AD details here? Otherwise, why are you duplicating the AD database?

If you are storing additional information, then you should name the table according to whatever domain/business object is modelled by the table.

As I said, I was storing the data for users, so my table was simply called [Users].

Finally - perhaps you would benefit from normalising this out into a [Groups] and a [Users] table?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文