Link 实体与 PostToCategory 实体,如果直接通过 builder.ToTable("blog_Links")
映射到同一张表会报下面的错误
System.InvalidOperationException: Cannot use table 'blog_Links' for entity type 'Link' since it is being used for entity type 'PostToCategory' and potentially other entity types, but there is no linking relationship. Add a foreign key to 'Link' on the primary key properties and pointing to the primary key on another entity type mapped to 'blog_Links'.
通过一个变通方法解决了,在 SQL Server 数据库中添加一个指向 blog_Links 的同义词(synonym)欺骗一下 EF Core,其中一个实体映射到这个 synonym