0
使用代码优先数据注释,如果我已经指定了属性的关键属性,那么这也会使它成为必需的,还是我需要两者?如果我已经指定Key,是否需要指定Required?
基本上,如果我想确保我的主键被填充,做我需要做的是:
[Key]
[Required]
public Guid UserId { get; set; } //internal id
还是将足够了:
[Key]
public Guid UserId { get; set; } //internal id