之前用的是 .net core 2.2 ,一对一映射关系是这么配置的
builder.OwnsOne(post => post.ViewCount).HasForeignKey(vc => vc.EntryId);升级至 .net core 3.0 之后,不支持 OwnsOne 之后直接跟 HasForeignKey ,必须要加 WithOwner ,于是改为:
builder.OwnsOne(post => post.ViewCount).WithOwner().HasForeignKey(vc => vc.EntryId);但运行报错
The type 'ViewCount' cannot be configured as non-owned because an owned entity type with the same name already exists请问如何解决这个问题?
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1446/viewspace-3153359/ ,如需转载,请注明出处,否则将追究法律责任。