SQL数据库设计建议:命名数据库表
我必须创建一个表并存储代表用户或组的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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Active Directory 对两者使用术语“主体”或“安全主体”。这也包括计算机。
以下是 MSDN 文章 在 .NET Framework 3.5 中管理目录安全主体的图片 显示层次结构。
(来源:microsoft.com)< /sub>
因此,我可能会调用我的表
Principals
并包含您提到的三列: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.
(source: microsoft.com)
So I would probably call my table
Principals
and have the three columns you mentioned:从最详细到最简单:
良好的做法规定表名称应该是复数,并且名称应该代表和描述表的内容。根据您的舒适程度,上述任何一项都应该可以。
From most verbose to least:
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.
当我最近不得不执行此操作(将数据库用户表链接到 AD 帐户)时,我只是将列命名为 ADSID。
我发现这对我们来说很有意义,因为我们使用 DirectorySearcher 进行查询,并且 LDAP 数据库中该属性的名称是 objectSid,因此我们的查询如下所示:
虽然,当我从项目中剪切粘贴该代码时,我确实想知道是否也许 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:
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?