Blazor: Query Builder changes Lambda to String

Using the Query Builder to add a sort parameter causes the meta filter value to become an array.
This appears to cause a string to be generated instead of the Lambda expression.

Come to think of it, is server-side sorting even possible with the current Blazor implementation?

TIA,
Josh

Thanks for the report Josh, we will fix that in the next release (before the end of the week). Yes, server-side paging, filtering and sorting is possible, all you need to do is to assign IQueryable to Data property.

Thanks @enchev. Could you briefly describe how best to make the Data property IQueryable in the Designer? I'm trying to affect the default sort of a ListBox. The ListBox data of dependent on the RowSelect of a DataGrid.

Probably going about this the wrong way, but the only way I can find to do this is like so:

${result.value}.AsQueryable().OrderByDescending(i => i.RunDate)

But you cannot enter IQueryable<JobDate> property type in the drop down so I have to edit the meta file.

Is there a reason you're returning IEnumerable from the DataService instead of IQueryable? Seems the latter would be more powerful and performant for SQL Server anyway.

Thanks,
Josh

Hi Josh,

We plan to add $orderby paramater similar to $filter where you can apply desired order similar to Angular projects:

Hi Josh,

We've just released update with enabled sorting and filtering for Blazor projects using query builder. To simplify the code we've used dynamic Linq (if you wonder why the expressions are strings):

...
protected async void Load()
{
     someProperty = 2;

     var sampleGetOrdersResult = await Sample.GetOrders($@"i => i.Id >= 3 && i.UserName.Contains(""{someProperty}"")", "UserName desc,Id asc");
     getOrdersResult = sampleGetOrdersResult;
}
...

All operations will be applied server-side:

The service also will return IQueryable instead IEnumerable if you want to add additional expressions.

Best Regards,
Vladimir

@enchev, That's so cool! I tried for years to get MSFT to implement Dynamic Linq Library in LightSwitch. Passing expressions as text is so much easier. Hmmm I wonder if we can do plain text like:
.Where("Id = 3 OR UserName = "%SomeProperty%"")

Thanks for the quick response. Now if only RadZen had the ability to model querys on entities in the dataservice.

Guys, again, thank you, this is great! Might be my imagination but I think it's much faster performance with IQueryable. PS... Had to infer from database again to get it to regen the dataservice, but that's expected behavior I think. Or perhaps the fact that I had DataService.cs in ignore list prevented upgrade(?)

Hi Josh,

Glad you liked the update - indeed should be much faster now!

If the service was ignored this will prevent Radzen to generate the new code. Yes, you can use strings to set expressions for sorting and filtering. You can use string.Format, template strings, etc.

More improvements are coming!

Best Regards,
Vladimir