这是我的班级编队:
namespace CVtheque.Entities
{
public class Formation
{
public Formation()
{
this.CVs = new HashSet<CV>();
}
public int Id { get; set; }
public string name { get; set; }
public virtual ICollection<CV> CVs { get; set; }
}
}
这是我的班级简历
namespace CVtheque.Entities
{
public class CV
{
public CV()
{
this.Formations = new HashSet<Formation>();
}
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Formation> Formations { get; set; }
[InverseProperty("CVs")]
public Personne Personne { get; set; }
}
}
我从这两个类创建了一个 DBContext,并自动创建了“join”表 FormationsCVs。
在网页上,用户可以启用或禁用每个 CV 的某些 Formations。请问如何在控制器中使用 linq 语法清除表格 FormationCVs ?以及如何插入新人?(CV1Id, Formation1Id), (CV1Id, Formation2Id) 等等..