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

时间:2022-01-14 12:57:17

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

我必须创建一个表并存储表示用户或组的活动目录sid。

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

如何命名既代表用户又代表组的类别?

Edit 1.

编辑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.

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

3 个解决方案

#1


3  

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

Active Directory对两者都使用术语“principal”或“security principal”。还包括电脑。

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

下面是在。net Framework 3.5中管理目录安全主体的MSDN文章中的grahpic图像,其中显示了层次结构。

alt text http://i.msdn.microsoft.com/cc135979.fig02(en-us).gif

alt文本http://i.msdn.microsoft.com/cc135979.fig02(en - us)gif

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

所以我可能会调用我的表格主体,让你提到的三列:

  • PrincipalName (string)
  • PrincipalName(字符串)
  • SID (string or binary)
  • SID(字符串或二进制)
  • PrincipalType (0 for User, 1 for Group)
  • PrincipalType(用户0,组1)

#2


0  

From most verbose to least:

从最冗长到最少:

  • ActiveDirectorySecurityIdentifiers
  • ActiveDirectorySecurityIdentifiers
  • ActiveDirectorySIDs
  • ActiveDirectorySIDs
  • ADSIDs
  • 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.

良好的实践要求表名是复数的,表名应该表示和描述表的内容。根据你的舒适程度,以上任何一种都可以。

#3


0  

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

当我最近不得不这样做(将DB用户表链接到AD帐户)时,我只是将列命名为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:

我发现这对我们很有意义,因为我们使用DirectorySearcher查询,LDAP数据库中的属性的名称是objectSid,所以我们的查询看起来是:

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?

虽然,当我从我的项目中剪切代码时,我想知道objectSid是否也会是一个很好的列名?

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

正如我所说,我为用户存储数据,所以我的表被简单地称为[users]。

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

最后——也许您将从将其规范化为[组]和[用户]表中获益?

#1


3  

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

Active Directory对两者都使用术语“principal”或“security principal”。还包括电脑。

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

下面是在。net Framework 3.5中管理目录安全主体的MSDN文章中的grahpic图像,其中显示了层次结构。

alt text http://i.msdn.microsoft.com/cc135979.fig02(en-us).gif

alt文本http://i.msdn.microsoft.com/cc135979.fig02(en - us)gif

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

所以我可能会调用我的表格主体,让你提到的三列:

  • PrincipalName (string)
  • PrincipalName(字符串)
  • SID (string or binary)
  • SID(字符串或二进制)
  • PrincipalType (0 for User, 1 for Group)
  • PrincipalType(用户0,组1)

#2


0  

From most verbose to least:

从最冗长到最少:

  • ActiveDirectorySecurityIdentifiers
  • ActiveDirectorySecurityIdentifiers
  • ActiveDirectorySIDs
  • ActiveDirectorySIDs
  • ADSIDs
  • 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.

良好的实践要求表名是复数的,表名应该表示和描述表的内容。根据你的舒适程度,以上任何一种都可以。

#3


0  

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

当我最近不得不这样做(将DB用户表链接到AD帐户)时,我只是将列命名为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:

我发现这对我们很有意义,因为我们使用DirectorySearcher查询,LDAP数据库中的属性的名称是objectSid,所以我们的查询看起来是:

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?

虽然,当我从我的项目中剪切代码时,我想知道objectSid是否也会是一个很好的列名?

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

正如我所说,我为用户存储数据,所以我的表被简单地称为[users]。

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

最后——也许您将从将其规范化为[组]和[用户]表中获益?