MVC中数据库表如果是一对一的主键关系时要加[Required]不然会出错Unable to determine the principal end of an association between the types

Unable to determine the principal end of an association between the types '***. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.

 [Required]  
 public virtual User User { get; set; }

解决的是如下情况:

Unable to determine the principal end of an association between the types '***. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.

相关文章:

  • 2022-01-12
  • 2022-01-12
  • 2021-09-10
  • 2021-11-24
  • 2021-05-29
  • 2021-05-04
  • 2021-08-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-04
  • 2021-12-19
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
相关资源
相似解决方案