Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用代码优先方法来创建数据库。我在两个表用户和员工之间有多对多的关系。出现在数据库中的查找表是 UserEmployee。如何反转此查找表的名称顺序,即 EmployeeUser,如果我这样做可能会产生什么影响。
您将不得不使用 fluent API 来完成它:
builder.Entity<Employee>() .HasMany(e => e.Users).WithMany(u => u.Employees) .Map(t => t.MapLeftKey("EmployeeId") .MapRightKey("UserId") .ToTable("EmployeeUser"));