我有三个班
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Product> Products { get; set; }
}
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<User> Users { get; set; }
}
public class ProductXUser // Mapping class
{
public int Id { get; set; }
public int User_Id { get; set; }
public int Product_Id { get; set; }
public DateTime DateMapped { get; set; }
}
如何使用类作为映射表在User
类和类之间映射多对多关系(使用 Fluent API) ?Product
ProductXUser