Insert entity with many to many related entities which exist in the database
问题 I have two objects with many to many relationship: public class Order { public int OrderID { get; set; } public string OrderName { get; set; } public virtual Collection<Product> Products { get; set; } = new Collection<Product>(); } public class Product { public int ProductID { get; set; } public string ProductName { get; set; } public int OrderID { get; set; } public virtual Collection<Order> Orders { get; set; } = new Collection<Order>(); } // Mapping table public class OrderProduct { public