Code Monkey home page Code Monkey logo

Comments (9)

vklymchuk avatar vklymchuk commented on July 17, 2024 1

With sortBy = null in the model and

      var filteredQuery = query.GridifyQueryable(filter);
      var data = filteredQuery.Query.OrderBy(q => q.StartDate).ToList();

it works.

from gridify.

vklymchuk avatar vklymchuk commented on July 17, 2024 1

I'll try to make a repro project.

from gridify.

vklymchuk avatar vklymchuk commented on July 17, 2024 1

I successfully reproduced bug in my cleared solution. And after that I decided to update EntityFrameworkCore to a newer bugs patch version. Of course it works )).
So it's my fault and that thing I had to do first.
Thanks for your support.

from gridify.

alirezanet avatar alirezanet commented on July 17, 2024

Hello @vklymchuk, Looks like this is an Entity framework exception. In EF 3.x or up you have some limitations in server-side queries that you need to do on the client-side.

Please add an .OrderBy( q => q.StartDate ) on your query and remove SortBy = "" to make sure this is a Gridify issue not EF one.

from gridify.

vklymchuk avatar vklymchuk commented on July 17, 2024

image

//-----------------------------------------------------------------------------------------------------------------//

image

from gridify.

alirezanet avatar alirezanet commented on July 17, 2024

I am investigating the problem but I have not been able to simulate it yet,

      [Fact]
      public void ApplyOrdering_SortBy_DateTime()
      {
         var gq = new GridifyQuery {SortBy = "MyDateTime", IsSortAsc = true};
         var actual = _fakeRepository.AsQueryable()
            .ApplyOrdering(gq)
            .ToList();
         var expected = _fakeRepository.OrderBy(q => q.MyDateTime).ToList();

         Assert.Equal(expected, actual);
         Assert.Equal(expected.First().Id, actual.First().Id);
      }

what version of EntityFramework are you using?

from gridify.

vklymchuk avatar vklymchuk commented on July 17, 2024

Microsoft.EntityFrameworkCore 3.1.0

from gridify.

vklymchuk avatar vklymchuk commented on July 17, 2024

The same situation is in another service with different query. Both have inner joins and some left joins. Both make a new projection of all the tables to a ViewModel.

from gridify.

alirezanet avatar alirezanet commented on July 17, 2024

All Gridify is doing is simply replacing your text representation with an expression, so normally if Gridify generated expression can't be translated by EFCore, normal calls like .OrderBy must have the same problem. the weird part, in this case, is your manual OrderBy is working!
can you provide a small sample of your situation? I need to somehow reproduce the problem to find out what is wrong

from gridify.

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.