Binder un DataGridView à partir de 3 tables avec EF
Bonjour, voici mon problème:
j'ai une table Commande(id..) qui est relié en n-n à une table Produit(id,libelle,prix)
Cela me donne la table LigneCommande(idCom,idProd,quantite)
je voudrais afficher dans un DataGridView Libelle Prix Quantite pour chaque Ligne de Commande
j'avais lu une solution pour binder à partir d'une table avec clé étrangère mais je n'ai pas trouver pour une table d'association nn.
voici ce que j'ai essayé :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
this.DGV.DataSource = from P in Entity.Produits
from L in Entity.LignesCommandes
from C in Entity.Commandes
where P.Identifiant == L.IdentifiantProduit &&
C.Identifiant == L.IdentifiantCommande &&
C.Identifiant == commande.Identifiant
select new
{
Produit = P.Libelle,
Quantité = quantite,
Prix = P.Prix
}; |
mais cela ne marche pas.
Avez vous une solution à partir de cela
ou sinon comment peut on faire avec le Linq to Entity??
merci