Not the same thing. I need to know that there is one, and exactly one, result.
I'll note, removing that line check and just returning FirstOrDefault works for me in terms of not throwing an exception... however, as my last post specified, I feel that the issue is something more sinister. My research into this today tends to suggest that there is some sort of Release only bug with regard to NHibernate executing queries. Whether this is due to something odd I'm doing that Release mode breaks, or something in the NHibernate LINQ code, is the question. In NHProfiler in Release mode, I am seeing the begin transaction and commit transaction calls, but I am seeing NONE of the SQL calls that should be made. / Michael / On May 31, 4:16 pm, Michael Teper <[email protected]> wrote: > I know this doesn't directly address your question, but have you > considered using results.Any() in place of results.Count > 1 ? > > -Michael > > On May 31, 1:11 pm, Beefy <[email protected]> wrote: > > > > > > > > > Haha, yes, sorry, I was combining code and made a typo. > > > In my code, it's actually this.Find().Where(predicate), where Find() > > is returning Session.Query<T>(); > > > So yes, the syntax is Session.Query<T>().Where(predicate); > > > More info: When I run this through NHProfiler, I am not getting any > > SQL statements spit out when running in Release mode, whereas in Debug > > mode, I get a whole slew of them, as expected... almost as if when > > compiled in Release mode it is skipping a line where it actually > > executes all the queries... > > > / Michael / > > > On May 31, 4:03 pm, Ramon Smits <[email protected]> wrote: > > > > > var results = Session.Query<User>.Find().Where(x => x.Email = > > > > email) > > > > Strange syntax... Shouldn't this be > > > Session.Query<User>().Where(x=>x.Email==email) ?- Hide quoted text - > > > - Show quoted text -
