Details

    • Sprint:

      Description

      This issue may be a duplicate of #NH-2265.

      Paging behaviour has changed since version 2.X of NHB.

      Im using NHB 3.2.0.4000 from Nuget, together with FluentNHibernate.

      This problem is the same with Query, QueryOver and ICriteria.

      Skip() + Take() behavior is not consistent with std behavior.
      Please have a look at the following tests to understand the problem.

      Test
      public void TestSkipAndTake_CommonMsLinqBehaviour_ShouldYield20()

      { var ints = Enumerable.Range(0, 40); Assert.That(ints.Skip(20).Take(20).Count(), Is.EqualTo(20)); }

      Test
      public void TestSkipAndTake_ShouldYield20_ButWillFailDueToNHBBug()
      {
      using (var session = _sessionFactory.OpenSession())

      { var jobs = session.QueryOver<SyncJob>() .Skip(20) .Take(20) .List(); Assert.That(jobs.Count(), Is.EqualTo(0)); }

      }

      Test
      public void TestSkipAndTake_ShouldYield20_WorkAround()
      {
      using (var session = _sessionFactory.OpenSession())

      { var jobs = session.QueryOver<SyncJob>() .Skip(20) .Take(40) .List(); Assert.That(jobs.Count(), Is.EqualTo(20)); }

      }

      Currently I've simply applied the workaround as this is OK for my app, but it probably is not OK for a lot of other apps.

      Hope you guys can fix this in the next release.

      And ohh by the way, thanks for a ingenious product .

      Kind regards
      Christian Mikkelsen

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                flukefan Richard Brown
                Reporter:
                christian mikkelsen Christian Mikkelsen
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?