这听起来更像是一种关系而不是对我的继承。也就是说,所有的实体都是用户,但有些用户与其他用户有创建者关系,有些用户具有指定的关系。建立这个模型最简单的方法可能是为创作者创建一个连接表,为受让者创建另一个连接表。从连接表中的两列创建外键关系回到用户表。将所有这些表格拖放到设计器表面时,每个用户都将获得createdBy/created和assignee /分配给实体集合。我假设,你的数据库约束将限制它,以便每个用户只有一个创建者,并且一个用户没有被分配给多个其他用户(或者根据你的规则可能不是)。
user table
user_id int identity not null primary key
user_name varchar
....
created_by
created_by_id int identity not null primary key
creator int not null, FK to user.user_id
createe int not null, FK to user.user_id
(with a unique index on creator/createe -- or both could be the PK)
(constraint creator <> createe)
assigned_to
assigned_to_id int identity not null primary key
owner_id int not null, FK to user.user_id
assignee_id int not null, FK to user.user_id
(with a unique index on assignee_id -- or not)
(constraint owner_id <> assignee_id -- or not)