Before the Update, I would have "EstimateCart.ClientCode desc" or "EstimateCart.ClientCode asc" in the args.OrderBy Property of the LoadDataArgs parameter.
Now, I have 'np(EstimateCart.ClientCode) desc'. I don't why the np(...) is added.
If I have a simpler Property with just one level, as SortProperty="ClientCode", I don't have the problem.
This is Dynamic LINQ expression and it was added to handle null values in complex properties. Before this fix EstimateCart.ClientCode will throw exception if EstimateCart is null.
The LINQ expression [...] could not be translated. 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'. See Client vs. Server Evaluation - EF Core | Microsoft Docs for more information.
Could you please help me with this?
Thanks in advance.
What is your query provider? We cannot reproduce such error locally - for example sorting on our Sample database Order Details complex properties with Microsoft SQL Server:
Without the np() operator the query is translated with no problem, even with the new Brand {} object:
SELECT [b].[Id], [b].[Name], (
SELECT COUNT()
FROM [Product] AS [p0]
WHERE [p0].[BrandId] = [b].[Id]) AS [ProductCount], (
SELECT COUNT()
FROM [Product] AS [p1]
WHERE [p1].[BrandId] = [b].[Id] AND [p1].State = 1) AS [PublishedProductCount]
FROM [Brand] AS [b]
ORDER BY (
SELECT COUNT(*)
FROM [Product] AS [p]
WHERE [p].[BrandId] = [b].[Id])
The problem arises when the np() operator is sent by the grid. Is there any way to avoid having the np() sent for complex grid columns ?
I'll repeat myself: Select with new object cannot be translated to SQL and there is not Select with projection in the SQL you've posted:
There is no way to remove null propagation expression for complex properties when the DataGrid is bound to IQueryable however you can use LoadData to perform your own sorting using the information provided in the event argument.