[英]The entity type 'List<Guid>' requires a primary key to be defined
The entity type 'List' requires a primary key to be defined.实体类型“列表”需要定义一个主键。 If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'.
如果您打算使用无密钥实体类型,请在“OnModelCreating”中调用“HasNoKey”。
I already define Id as the primary key here.我已经在这里将 Id 定义为主键。 but still, it's failing the Dotnet test case.
但是,它仍然没有通过 Dotnet 测试用例。
[Key]
public int Id { get; set; }
public List<Guid> Books { get; set; }
Creating a Book class would fix this.创建一本书 class 将解决此问题。 Then use
List<Book>
instead of List<Guid>
.然后使用
List<Book>
而不是List<Guid>
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.