Error with RadzenGrid when trying to sort an unmapped entity property

I have an EF core entity ("Target") which I display inside a Radzen DataGrid. On this entity I have an unmapped property called "CountUsed".

When I try to sort it, I get the following exception:
[2021-03-08T22:35:22.300Z] Error: System.InvalidOperationException: The LINQ expression 'DbSet()


        inner: DbSet<ApplicationUser>(), 

        outerKeySelector: t => EF.Property<string>(t, "CreatorId"), 

        innerKeySelector: a => EF.Property<string>(a, "Id"), 

        resultSelector: (o, i) => new TransparentIdentifier<Target, ApplicationUser>(

            Outer = o, 

            Inner = i


    .Where(t => t.Inner == __currentUser_0 && t.Outer.DomainId == __domainId_1)

    .OrderBy(t => t.Outer.Name)

    .OrderBy(t => t.Outer.CountUsed)' could not be translated. Additional information: Translation of member 'CountUsed' on entity type 'Target' failed. This commonly occurs when the specified member is unmapped. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'.

I fetch the list of targets, on page load. The error does not occur, when I call .ToList() on the targets list. But I guess I shouldn't do that in a productive environment (as noted in the documentation of the DataGrid), probably for performance reasons?

So I wonder, how can I avoid this error, without using ToList()?

Hey @Shihan,

Not mapped properties cannot be used in database queries. The only way to achieve your goal is to use LoadData to check if the sort or filter is initiated for such property and convert your database query to in-memory with ToList().

Okay, thanks for the response.

I think I'll try to convert the mapped property to something like a SQL calculated column.