Utilisation de last et any
bonjour,
j'ai cette ligne de code :
Code:
context.Personne.Where(Function(x) x.DemandeLogement.Any(Function(y) y.CritereRecherche.CritereRecherche_TypeHabitation.Any(Function(z) z.IdTypeHabitation = CLng(item)))).ToList
À la place du Any, j'aimerai Utiliser Last.
Code:
context.Personne.Where(Function(x) x.DemandeLogement.Last.CritereRecherche.CritereRecherche_TypeHabitation.Any(Function(z) z.IdTypeHabitation = CLng(item))).ToList
Seulement le compilateur me dit :
Citation:
LINQ to Entities does not recognize the method 'Gestion_Demande_Logement_CPAS.DemandeLogement Last[DemandeLogement](System.Collections.Generic.IEnumerable`1[Gestion_Demande_Logement_CPAS.DemandeLogement])' method, and this method cannot be translated into a store expression
Je ne comprend pas pourquoi je ne peux pas faire ma recherche sur le dernier élément de DemandeLogement dans la première clause Where.
Ma question est : comment dois-je m'y prendre.