Invoke Datasource method and $select parameter Blazor-serverside

Hi ,

I have started to re-build / migrate Radzen Angular app to Radzen Blazor serverside .
When invoking a data source method there are some parameters we can set like $orderby,$expand,$top,$skip and $select . The last one "$select" is only in Radzen Angular and seems not to be enabeld in Radzen Blazor.
image

I have copied the page layout from Radzen Angular to Radzen Blazor app from one designer with the Angular app to other designer with the Blazor app open. This works after some tweaks, this saves me some time to re-building the page from scratch.

My question, do we no longer need the $select parameter in the Blazor query designer ?

When I put the $select parameter with the desired columns in the meta "json" of the page manually, I see the following in the designer, the values are there butg not the name of the parameter.
image

In the Radzen Output window within the designer I can see that the query produced to fetch the data has only the columns that I wanted, so it seems to work , but we can not assign the paramter form the designer.

The reason I want to exclude some columns from the query is because they contain large data and it slows down the app.

Hope you can clearify .

Kind Regards,
Mehmet

Hi @mcanavar,

The only reason for this is the fact that in Angular/JavaScript it's easier to deal with any JSON produced from $select while in Blazor/C# this will create anonymous objects that can be used only with dynamic keyword. Still you are right that it will work runtime and we will enable this in our next update before the end of the week. You will need however to re-infer your data source or add $select for all operations that will return collection:

In this case Radzen designer will be able to pick the parameter:

1 Like

Hi @enchev ,

Thank you , I'm at te beginning of my transition of my app from Angular to Blazor , so it's no problem to re-infer.

Regards,
Mehmet

Re-infer is the same process you perform when there is an update in your database - you do not need to create any pages. This will just update the data source schema in meta/data.

1 Like

Hi @enchev ,
Thank you for the update , adding the $select and excluding the database fields with large content did boost the datagrid loading performance with 100%.

Very happy with this .

Kind Regards,
Mehmet

Hi @enchev ,
Maybe I was too quick to celebrate, did not notice any performance gain when used with production data and noticed that $Select is not used in the generated Service. hinge the code below , where no code check is for the Select part of the query.

public async Task<IQueryable<Models.MyApp.TableName>> GetTableName(Query query = null)
        {
            var items = Context.TableName.AsQueryable();
            items = items.AsNoTracking();

            if (query != null)
            {
                if (!string.IsNullOrEmpty(query.Expand))
                {
                    var propertiesToExpand = query.Expand.Split(',');
                    foreach (var p in propertiesToExpand)
                    {
                        items = items.Include(p);
                    }
                }

                if (!string.IsNullOrEmpty(query.Filter))
                {
                    if (query.FilterParameters != null)
                    {
                        items = items.Where(query.Filter, query.FilterParameters);
                    }
                    else
                    {
                        items = items.Where(query.Filter);
                    }
                }

                if (!string.IsNullOrEmpty(query.OrderBy))
                {
                    items = items.OrderBy(query.OrderBy);
                }

                if (query.Skip.HasValue)
                {
                    items = items.Skip(query.Skip.Value);
                }

                if (query.Top.HasValue)
                {
                    items = items.Take(query.Top.Value);
                }

        // No code for passing the Select values  ?? 
            //if(!string.IsNullOrEmpty(query.Select))
           //  {
          
           //   }
            
              }
            OnTableNameRead(ref items);

            return await Task.FromResult(items);
        }

My problem is that each record of some tables can contian up to 20 MB of base64 attachment, and using this data in a Datagrid retrieving at least 10 records or applying filters on runtime makes it hard to use the app. In Angular this was ommitted by using the Select parameter and excluding the fields that contained large data.

Also getting this error when using doubleclick to open the edit form , the edit page contains the large field , In the edit page this is needed , but gives some kind of timeout and app hangs .

and this error in the console.

besides these problems , the migration from Radzen designer Angular to Radzen designer Blazor pages goes surprisingly well .

Hope you can help with this issues.

PS: Not so clean work-around for now was to create a view without the large tablefield and use that for populating the DataGrid.

b.r
Mehmet

Hi ,
Just sharing my workaround method :

Instead of creating a view and infering it with Radzen.
I now use a custom method in the page ..razor.cs: like this and this works for me .
runtime filter and sorting on datagrid works and can retrieve only the fields needed and excluding fields with large data .

public async Task<IEnumerable<MyApp.Models.MyData.TableName>> GetPageTableName) {

           IEnumerable<MyApp.Models.MyData.TableName> result = 
                                  (from a in Context.TableNames
                                          where a.ID > 0
                                          orderby a.ID descending
                                          select new {
                                              a.ID, 
                                              a.Name, 
                                              a.Description, 
                                              a.CreatedDate 
                                          })
                                  .Select(a => new MyApp.Models.MyData.TableName
                                  {
                                      ID= a.ID,
                                      Name = a.Name,
                                      Description = a.Description,
                                      CreatedDate = a.CreatedDate
                                  }); 
    
            return await Task.FromResult((IEnumerable<MyApp.Models.MyData.TableName>)result);
    
        }

You are right and unfortunately I spoke to soon :frowning: .

There is no way to enable easily $select in the service since in this case we need to change the signature of the method which will lead automatically to breaking change in all existing applications. The only way I can think at the moment is to use custom method.

My Workaround mehtod I have with custom mehtod works fine for now, and I understand that this is a difficult one to implement if there are also breaking changes involved.

Thank you either way.

Hi,
Now that some of the applications gather more and more data , this begins to have effect on performance when there are fields in the table with large data.
The work-around to use custom methods does work but having this out of the box would really help with rapid application development.

Is this still something you are going to put on the roadmap for Radzen ?

Regards/
Mehmet

@mcanavar my last comment is still valid and we are not aware how to overcome this.