Entity Framework: field of composite key cannot be nullable?

前端 未结 3 1414
广开言路
广开言路 2020-12-03 17:22

I have a model with composite key - the row is the key:

public class Item
{
    [Key, Column(Order = 0)]
    public int UserId { get; set; }
    [Key, Column         


        
3条回答
  •  萌比男神i
    2020-12-03 17:47

    It is not possible. Every RDBMS requirement is, that primary key must be not nullable.

提交回复
热议问题