Radzen Blazor Studio generates service classes for database access. Your data is exposed as a set of methods that retrieve or manipulate data. For
example to get the records from the
Orders table you use the
GetOrders method. In Blazor server applications this method accepts an argument of type
Radzen.Query which allows to page, sort, filter the data. In Blazor WASM application the
GetOrders method has separate arguments that map to OData parameters
for filtering, sorting and paging (
To filter the data follow these steps:
- Find the Invoke statement in the method editor. In Blazor server applications it is typically in the
OnInitializedAsyncmethod. In WASM applications it is usually in the method which handles the
LoadDataevent of a RadzenDataGrid instance.
- Click the Query Builder button in the property grid.
- Add one or more filters - select a property, pick a comparison operator and specify the target value.
- Click OK
To sort the data follow the same steps. Just add the properties you want to sort by and specify the sort direction.
The Query Builder allows you to “expand” composite properties (related objects or colletions). Expanding means to eagerly load related data.
In Blazor server applications this is equivalent to using the
Include Entity Framework method (which does SQL
JOIN under the hood). In Blazor WASM applications expanding is literally using the
$expand OData operation.
In Query Builder simply check the required properties. Radzen Blazor Studio will only list the properties that can be expanded (objects and collections).
In Blazor WASM applications you can also select what properties to return from the OData service which Radzen Blazor Studio has generated for your database. This is equivalent
$select odata operator. If you don’t specify it all properties will be returned.
In Query Builder check the properties you want to be returned from the service.