Entity Framework 6 数据库优先不会在 Table 上使用复合键生成实体

Entity Framework 6 Database First Doesn't Generate Entity on Table With Composite Key

假设我有以下带有复合主键的 table 定义:

create table [dbo].[CustomerRequests] (
    [CustomerId] int not null,
    [RequestId] int not null,
    constraint [PK_CustomerRequests] primary key clustered ([CustomerId] asc, [RequestId] asc),
    constraint [FK_CustomerRequests_Customers] foreign key ([CustomerId]) references [dbo].[Customers] ([CustomerId]),
    constraint [FK_CustomerRequests_Requests] foreign key ([RequestId]) references [dbo].[Requests] ([RequestId])
);

当我更新模型以包含此 table 时,Entity Framework 无法生成实体 class。这是由于复合主键吗?有没有办法让 Entity Framework 生成实体 class?

Gert Arnold 的评论为我指明了正确的方向,

一旦我在两个主键之外添加了另一列,Entity Framework 就生成了实体。下面是一个示例 table 定义,EF Database First 将为其创建一个实体:

create table [dbo].[CustomerRequests] (
    [CustomerId] int not null,
    [RequestId] int not null,
    [TimestampUtc] datetime not null,
    constraint [PK_CustomerRequests] primary key clustered ([CustomerId] asc, [RequestId] asc),
    constraint [FK_CustomerRequests_Customers] foreign key ([CustomerId]) references [dbo].[Customers] ([CustomerId]),
    constraint [FK_CustomerRequests_Requests] foreign key ([RequestId]) references [dbo].[Requests] ([RequestId])
);