Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded
是如果子表主键,没有特殊说明,ef会默认认为这个字段数据库会自动生成,但是主表却可以
解决办法 配置子表//builder.Property(p => p.Id).ValueGeneratedNever(); 不自动生成id