Bonjour,
J'ai cherché plusieurs jours sans trouver de reponses à mon problème :
Au niveau de la premirere expression lambda WHERE, j'ai l'erreur suivante :
Je cherche en fait à faire une recherche multi critere sur la table INCIDENT, mais je veux faire des jointures pour recuperer les noms des colonnes des autres tables.ne prend pas en charge la traduction en SQL
J'ai donc crée une class que j'ai appelé CustomSearch dans laquelle je mets les champs/tables utilisées.
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
18
19
20
21
22 public List<CustomSearch> Search(INCIDENT myincident, STATUT_INCID mystatutincid, STATUT_INCID mystatutincid) { var IncidentQuery = from i in MyDAODataContext.INCIDENT join p in MyDAODataContext.PRIOTITE on i.PRIORITE_ID_PRIO equals p.ID_PRIO select new CustomSearch(myincident) { ID = i.APPLICATION_ID_APPLI, IDP = p.ID_PRIO, LIBprobleme = p.LIB_PRIO, nom_appli = i.NIV_SERVICE_ID_NIVSERV }; IncidentQuery = GetIncidentQuery(IncidentQuery, myincident, mystatutincid); return IncidentQuery.ToList(); } public IQueryable<CustomSearch> GetIncidentQuery(IQueryable<CustomSearch> IncidentQuery, INCIDENT myincident, STATUT_INCID mystatutincid) { if (myincident.NUM_TICKET!=null) IncidentQuery = IncidentQuery.Where(iq => iq.incident.NUM_TICKET == myincident.NUM_TICKET); if (!string.IsNullOrEmpty(mystatutincid.LIB_STATINCID)) IncidentQuery = IncidentQuery.Where(iq => iq.incident.STATUT_INCID.LIB_STATINCID == mystatutincid.LIB_STATINCID); return IncidentQuery; }
Et le code de ma class CustomSearch :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 public class CustomSearch { DAODataContext db; public INCIDENT incident; public STATUT_INCID statut { get; set; } public CustomSearch(INCIDENT pincident) { incident = pincident; } }
Merci d'avance de votre aide
Partager