Master Detail Hierarchy Not Filtering Child Data

When I scaffold a new Master/Detail Hierarchy page it is not filtering the child data and instead returning all results. Here’s the code it is generating:

        protected MyProject.Server.Models.MyDatabase.MyParentTable myParentTableChild;
        protected async Task GetChildData(MyProject.Server.Models.MyDatabase.MyParentTable args)
        {
            myParentTableChild = args;
            var MyChildTableResult = await MyDatabaseService.GetMyChildTable();
            if (MyChildTableResult != null)
            {
                args.MyChildTable = MyChildTableResult.Value.ToList();
            }
        }

I then have to add filtering to GetMyChildTable(). Can the filtering be added automatically when scaffolding these pages from RBS?

Usually the code looks like this:

protected TestSample.Models.Sample.Order orderChild;
protected async Task GetChildData(TestSample.Models.Sample.Order args)
{
  orderChild = args;
  var OrderDetailsResult = await SampleService.GetOrderDetails(new Query { Filter = $@"i => i.OrderId == {args.Id}", Expand = "Order,Product" });
  if (OrderDetailsResult != null)
  {
    args.OrderDetails = OrderDetailsResult.ToList();
  }
}

Make sure you have primary keys and relations setup properly.

All the keys and relations are set up properly. This worked just fine in Radzen Studio. Is there something wrong with my install of RBS?

Also, that syntax doesn’t work for me. I had to set up the query like this:

new Query { Filter = $"OrderId eq {args.Id}", Expand = "Order,Product" }

I can consistently reproduce this in both Radzen Blazor Studio and the plugin for Visual Studio using a variety of options.

In addition, I’ve noticed a few other issues with scaffolding Master/Detail Hierarchy pages:

  • When renaming the page during scaffolding, the Edit and Add pages are also updated as expected, but the code calling them from the child template does not get updated and the fields on the Edit and Add pages don’t get generated, but leave a malformed ChildContent tag
  • The Add page does not pass in the parent key value, so the parent has to be selected. I would expect this page to be generated with a parameter accepting the key value and the corresponding property automatically set to that value.

In this case your app is WebAssembly however I’m unable to replicate such problem using our Sample database and latest version of RBS: