Hi,
The application:
Please find the attached razor page that I am currently using as the most basic sample.
I have constructed a DataGrid which load its data using SfDataManager.
The table is called TRA_ATTENDUS.
The adaptor is a custom one and its instance is a class called SfDataAdaptorServices<TRA_ATTENDUS>.
The signature of the class: "public class SfDataAdaptorServices<TEntity> : DataAdaptor, IDisposable where TEntity : class, new()"
We implemented as well the CRUD exposed from the SfClass such "public override async Task<object> ReadAsync(DataManagerRequest dm, string key = null)" and so on... the ASYNC way
So, this class implement DataAdaptor class. It is injected as Scoped in Startup.cs: "services.AddScoped<SfDataAdaptorServices<TRA_ATTENDUS>>();"
For this sample, a unique foreign column is displayed into the grid. This column values are loaded into a List on OnInitializedAsync using the same service as the SfDataManager.
The issue:
When the razor page is loading, I can see that ReadAsync method (from SfDataAdaptorServices class) is called four times.
Resulting in the data of the grid being pulled four times from our database, using SQL Server Management/SQL profiler
I observe one call related to the FK (TRAPL_APPLICATIONS) and three related to the datagrid content (TRA_ATTENDUS). I was expecting only one call to the datagrid content.
Test case #1: (no issue)
If I don’t put any foreign columns in the grid (and only put “simple” columns), the read async method of SfDataAdaptorServices class is called once as expected.
Test case #2:
I put one or more foreign columns (because the TRA_ATTENDUS has up to 7 FK), the read async method of SfDataAdaptorServices is repeated more than expected.
Taking 5 foreign columns, I observe 12 calls to the read method: 5 equals to the 5 FK and 7 because the main datagrid request is repeated.
I can’t find why the data adaptor is called so many times instead of once, and if it is a normal way to use CustomDataAdaptor.
What are the events that could explain several calls to the data adaptor?
Can I force the data adaptor to read the data only once when the page is loaded?
Thanks for your help.
Best regards.
FrançoisHi Jeevakanth,
To answer your questions:
- The Nuget is Syncfusion.Blazor 19.1.0.54 (and formers like 18.4).
- It is a server side application.
- I am building ForeignKey with remote data (but in attached sample it is local data).
I joined a sample that reproduce my issue.
My DataGrid component is DatagridComponent.razor. It is displayed on the index page. The custom adaptor is CustomAdaptor.cs.
In this example the grid displays “order” with two foreign keys “Employee” and “Employee2”.
If I put a breakpoint in ReadAsync, I observe that ReadAsync is called three times.
If I put only one foreign key “Employee”, ReadAsync is called two times.
If I put no foreign key, ReadAsync is called once.
Can you explain why ReadAsync is called more times when there are foreign keys? I was expecting ReadAsync to be called once independently of the number of foreign keys.
Thanks for your help.
Best regards.
François
Hi,
What is the status of this since i am unable to open the provided issue link?
Kind regards,
Joris