From: Fabio M. (JIRA) <nh...@gm...> - 2011-05-30 18:13:47
|
[ http://216.121.112.228/browse/NH-2656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21232#action_21232 ] Fabio Maulo commented on NH-2656: --------------------------------- If you really want "make NHibernate Linq provider as good as possible" please provide a directly usable test case. http://nhforge.org/blogs/nhibernate/archive/2008/10/04/the-best-way-to-solve-nhibernate-bugs-submit-good-unit-test.aspx > First/FirstOrDefault Doesn't Work > --------------------------------- > > Key: NH-2656 > URL: http://216.121.112.228/browse/NH-2656 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Lee Timmins > > I have the following tests: > [TestMethod] > public void First() { > var result = _session.Query<Post>() > .OrderBy(p => p.Date) > .First(p => p.Comments.Count == 1); > Assert.AreEqual(1, result.PostID); > } > [TestMethod] > public void FirstOrDefault() { > var result = _session.Query<Post>() > .OrderBy(p => p.Date) > .FirstOrDefault(p => p.Comments.Count == 1); > var result2 = _session.Query<Post>() > .OrderBy(p => p.Date) > .FirstOrDefault(p => p.Comments.Count == 10); > Assert.AreEqual(1, result.PostID); > Assert.IsNull(result2); > } > They both worked fine in the old Linq provider (changing Query to Linq) but in version 3.1 it throws the error: > Test method NHibernate3_1.UnitTest.First(OrDefault) threw exception: > System.InvalidOperationException: Sequence contains no elements -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |