我设计了一个数据库来为UserID使用GUID,但是我将UserId添加为许多其他表的外键,并且因为我计划拥有大量的数据库输入,所以我必须设计好这个.
我还使用ASP Membership表(不是仅限成员资格,用户和角色).
所以目前我在每个其他表中使用GUID作为PK和FK,这可能是糟糕的设计?
我认为可能更好,并且是我的问题的来源,我应该将Users表UserId(int)作为主键添加并使用此字段作为其他表的外键和用户GUID UserId仅引用aspnet_membership?
aspnet_membership{UserID(uniqueIdentifier)}
Users{
UserID_FK(uniqueIdentifier) // FK to aspnet_membership table
UserID(int) // primary key in this table --> Should I add this
...
}
In other tables user can create items in tables and I always must add UserId for example:
TableA{TableA_PK(int)..., CreatedBy(uniqueIdentifier)}
TableB{TableB_PK(int)..., CreatedBy(uniqueIdentifier)}
TableC{TableC_PK(int)..., CreatedBy(uniqueIdentifier)}
...