Upate: While the above fixes the mapping issue, it introduces another issue known as multiple cascade paths, because by the default EF conventions cascade delete is on for one-to-many relationships. Since you need fluent configuration anyway to turn the cascade delete off for one or both relationships, you'd better remove ForeignKey and InverseProperty annotations and configure the whole thing fluently:modelBuilder.Entity<Product>() .HasRequired(e => e.CreatedByUser) .WithMany(e => e.CreatedProducts) .HasForeignKey(e => e.CreatedBy) .WillCascadeOnDelete(false);modelBuilder.Entity<Product>() .HasRequired(e => e.ModifiedByUser) .WithMany(e => e.ModifiedProducts) .HasForeignKey(e => e.ModifiedBy) .WillCascadeOnDelete(false); 这篇关于指定的架构无效.错误:关系&#39; Product_CreatedByUser&#39;未加载,因为类型&#39; User&#39;不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-11 17:23