Code First .
There are models of Product and User . A user can have many products purchased online and many purchased offline. At the same time, the product has a list of users who purchased online and a list of offline, respectively.
It turns out we have 2 connections many to many. How to implement it in classes of models?
public class Product { public int Id { get; set; } public int Price { get; set; } public virtual ICollection<User> OnlineCustomers { get; set; } public virtual ICollection<User> OfflineCustomers { get; set; } } public class User { public int Id { get; set; } public string Name { get; set; } public virtual ICollection<Product> OnlinePurchases { get; set; } public virtual ICollection<Product> OfflinePurchases { get; set; } } As far as I know, with many to many connections, EF automatically creates a third table, calling it ProductUsers . But if there are two links, how will additional tables be named? And how can you change the naming rule for intermediate tables, which attribute or Fluent API?