GUIDを使用するデータベースを設計しましたUserID
が、他の多くのテーブルに外部キーとして追加UserId
しました。非常に多くのデータベース入力を計画しているため、これを適切に設計する必要があります。
ASPメンバーシップテーブルも使用します(メンバーシップ、ユーザー、およびロールのみのプロファイルではありません)。
したがって、現在、他のすべてのテーブルで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)}
...