public class キー { public List<講師> 講師陣; public List<学生> 学生達; public void Add(講師 追加する講師, 学生 追加する学生) { 追加する講師.外部キー = this; 追加する講師.教えてる学生達.Add(追加する学生); 講師陣.Add(追加する講師);
追加する学生.外部キー = this; 追加する学生.師事する講師達.Add(追加する講師); 学生達.Add(追加する学生); } public キー(){ 講師陣 = new List<講師>(); 学生達 = new List<学生>();} }
public class 講師 { public int Id {get;set;} public List<学生> 教えてる学生達; public キー 外部キー{get;set;} public 講師(){ 教えてる学生達 = new List<学生>();} }
public class 学生 { public int Id {get;set;} public List<講師> 師事する講師達; public キー 外部キー{get;set;} public 学生(){ 師事する講師達 = new List<講師>();} }