Giter Site home page Giter Site logo

Comments (7)

StefH avatar StefH commented on May 17, 2024

I did create a unit-test which tests your scenario, but it seems to work fine.
Can you check the linked commit on this issue ?

from system.linq.dynamic.core.

jotab123 avatar jotab123 commented on May 17, 2024

Your test works fine because you are getting the type from first element in the IQueryable results.

This test should fail:

        [Fact]
        public void SkipTestForEqualElementType()
        {
            // Arrange
            var testUsers = User.GenerateSampleModels(100).AsQueryable();

            // Act
            IQueryable results = testUsers.Where("Income > 10");
            var skipResult = results.Skip(1).Take(5);
            Assert.Equal(results.ElementType , skipResult.ElementType);
        }

from system.linq.dynamic.core.

jotab123 avatar jotab123 commented on May 17, 2024

Checking another projects I found they are using IQueryable.Provider to create a query and seems to works fine. Maybe is a good aproach to solve this.

        public static IQueryable Take(this IQueryable source, int count)
        {
            if (source == null) throw new ArgumentNullException("source");
            return source.Provider.CreateQuery(
                Expression.Call(
                    typeof(Queryable), "Take",
                    new Type[] { source.ElementType },
                    source.Expression, Expression.Constant(count)));
        }

Class link: System.Linq.Dynamic

from system.linq.dynamic.core.

StefH avatar StefH commented on May 17, 2024

Thanks.

Issue is solved, new NuGet 1.0.6.0 is uploaded.

from system.linq.dynamic.core.

jotab123 avatar jotab123 commented on May 17, 2024

Great! I was checking it and works fine.

It would be interesting that Take method could take 0 value also, an return the IQueryable instead of an error. In my case, I'm using a variable as take index and sometimes is 0, and It's valid. Actually I have to check if take = 0 and set it as 1.

Good job!

from system.linq.dynamic.core.

StefH avatar StefH commented on May 17, 2024

New version added to NuGet

from system.linq.dynamic.core.

jotab123 avatar jotab123 commented on May 17, 2024

Works fine! thanks

from system.linq.dynamic.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.