Bonjour,
Je souhaiterais connaître le type de retour à attribuer à une méthode effectuant un select avec LINQ.
Je m'explique.
J'ai un service WCF qui effectue une requête dans une table nommée TECHNO :
Ceci me retourne une erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 namespace WcfThierry { public class DataTechno : IDataTechno { public List<quel type choisir ?> getTechno() { TechnoDataContext dc = new TechnoDataContext(); var allTechno = (from techno in dc.TECHNO orderby techno.LIBELLE_TECHNO select new { techno.ID_TECHNO, techno.LIBELLE_TECHNO }); return allTechno.ToList(); } } }car le type de retour que je définis pour la méthode getTechno() est faux.impossible de convertir implicitement List<Anonymous Type> en List<TECHNO>
Pour info, j'ai d'abord mis comme type un "string" puis j'ai crée une structure à 2 élément (un int comme ID_TECHNO et un string comme LIBELLE_TECHNO) mais sans résultat.
Avez-vous une idée ?
Merci.
T.
Partager