Requires a primary key to be defined. If you intended to use a keyless entity type, call ‘HasNoKey‘
.netcore中使用code-first时,在entity中使用类做为字段,在执行新的迁移,使用命令Add-Migration时,会发生以下报错Requiresaprimarykeytobedefined.Ifyouintendedtouseakeylessentitytype,call‘HasNoKey’这时需要在MigrationsDbContext中添加//为类添加HasNoKey的属性b