我有3類:(人事,Chirurgien和操作)C#加入條款與關聯表
public class Personnel
{
[Key]
public int CodePersonel { get; set; }
public FullName NomComplet { get; set; }
public Adresse Adress { get; set; }
public int Age { get; set; }
public ICollection<Operation> Operation { get; set; }
}
Chirurgien
public class Chirurgien : Personnel
{
public int Nbre_anne_Exp { get; set; }
public int NoteXP { get; set; }
}
和操作:
public class Operation
{
public int OperationId { get; set; }
public DateTime DateDebut { get; set; }
public DateTime DateFin { get; set; }
public int Duree { get; set; }
public bool Etat { get; set; }
public string CIN { get; set; }
public ICollection<Personnel> Personel { get; set; }
public Patient Patients { get; set; }
public override string ToString()
{
return CIN;
}
}
,我也創建關聯表「Membre」
HasMany(p => p.Personel).WithMany(v => v.Operation).Map(m => {
m.ToTable("Membre");
m.MapLeftKey("Operation");
m.MapRightKey("Personel");
});
我怎樣才能得到那些失敗的操作(操作行政法院= FALSE)Chirurgien名單?
我用這個代碼返回完整Chirurgien名單:
public ICollection<Chirurgien> NoobDoctors()
{
var req = from t in ut.getRepository<Chirurgien>().GetAll()
select t;
return req.ToList();
}
謝謝
LINQ查詢是多餘的 - 只要使用'返回ut.getRepository().GetAll()ToList();'。 –
NetMage