Je tire mes cheveux par ici et je ne suis pas sûr de ce qui le cause.Nhibernate Linq Erreur sur Single ou par défaut
je la requête LINQ suivante:
return Session.Linq<CandidateAccountEntity>().SingleOrDefault(p => p.UserName.ToLower().Equals(userName.ToLower()));
et son lancer l'erreur suivante:
Index was out of range. Must be non-negative and less than the size of the collection.
Si je tente de l'envelopper avec un chèque de:
if(Session.Linq<CandidateAccountEntity>().Any()) {...}
alors j'obtiens l'erreur suivante:
could not execute query [ SELECT count(*) as y0_ FROM [CandidateAccountEntity] this_ inner join CFG.Account this_1_ on this_.AccountEntity
1_id=this_1_.AccountId ] [SQL: SELECT count(*) as y0_ FROM [CandidateAccountEntity] this_ inner join CFG.Account this_1_ on this_.AccountEntity
1_id=this_1_.AccountId]
à l'exception intérieure:
{"Incorrect syntax near '`'."}
Toute aide serait grandement, grandement apperciated. Je ne veux pas rester coincé ici vendredi après-midi:/
Voir aussi: http://stackoverflow.com/questions/2598202/does-nhibernate-linq-support-tolower-in-where-clauses –