Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Hartfield 6 posts 88 karma points
    Oct 26, 2023 @ 11:08
    Simon Hartfield
    0

    Using EF navigation properties for list view

    Hello,

    We're using EFCore for the repository and using some navigation properties for listing and sorting, and while the display works really well, we're having issues with the sorting.

    For example:

    class Address 
    {
        Country Country {get; set;}
    }
    
    class Country
    {
        string Name {get;set;}
    }
    

    We can use this:

    .ListView(listViewConfig => listViewConfig
        .AddField(p => p.Country.Name).SetHeading("Country")
    

    and the listing is correct and populates, but when we try to sort against the field, we get this for the sorting expression, which is not correct:

    Param_0 => Convert(Param_0.CountryName, Object)
    

    We haven't tested filtering, but it seems reasonable for the same issue to be present.

    Is there something we are supposed to be doing for this, or are we able to get the underlying request/context to extract the sorting ourselves?

    We also tend to use nested sorting, for example, sorting by country and then by county when the user sorts by country. Is this possible to configure, or, as above, can we get the sort field from Konstrukt so that we can build this ourselves.

    Thanks,

    Simon

Please Sign in or register to post replies

Write your reply to:

Draft