Hello Team Syncfusion,
I am attempting to track down an EFCore issue with SfGrid. My thought was to use a very basic EFCore sample SLN provided in your forums, but unfortunately I cannot find one. I did see this, but it's ASP.NET and from a few years ago:
In my case, I would like a simple Blazor SLN featuring net6.0 that has basic paging functionality.
Is there such a SLN available, by chance?
Thank you for any assistance you can provide,
Michael
Hi Mike-E,
Greetings from Syncfusion support.
We have documented a step by step topic to bind data to grid using EF in our documentation section. We suggest you to refer the below documentation and try this from your side. We have also attached a GitHub sample in below documentation. You can find the sample in this GitHub link.
https://blazor.syncfusion.com/documentation/common/data-binding/bind-entity-framework
Also please refer the below reference links,
https://blazor.syncfusion.com/documentation/datagrid/paging
https://blazor.syncfusion.com/demos/datagrid/paging?theme=fluent
Kindly refer the above links and try this from your side. Please get back to us with the exact scenario/problem you are facing if you need further assistance.
Regards,
Renjith R
Thank you very much for the sample and for taking the time to assist here Renjith. Please see the attached. Note that you will have to seed your database with 6 or more Book records to reproduce this.
I am paging through the result set with a custom adaptor. I see 3 different select statements as a result.
The initial one when the grid loads:
```
SELECT TOP(@__p_0) [b].[Id], [b].[Author], [b].[Available], [b].[Name], [b].[Price], [b].[Quantity]
FROM [Book] AS [b]
ORDER BY [b].[Id]
```
One on the first page:
```
SELECT [b].[Id], [b].[Author], [b].[Available], [b].[Name], [b].[Price], [b].[Quantity]
FROM [Book] AS [b]
ORDER BY [b].[Id]
OFFSET @__p_0 ROWS FETCH NEXT @__p_0 ROWS ONLY
```
And then one on the second+ page(s):
```
SELECT [b].[Id], [b].[Author], [b].[Available], [b].[Name], [b].[Price], [b].[Quantity]
FROM [Book] AS [b]
ORDER BY [b].[Id]
OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY
```
Each one of these select queries is a different compilation on the SQL Server side so this is a performance hit that I would like to reduce/remove. Ideally, there should only be one select statement generated for all queries and that is this one (the last one from above):
```
SELECT [b].[Id], [b].[Author], [b].[Available], [b].[Name], [b].[Price], [b].[Quantity]
FROM [Book] AS [b]
ORDER BY [b].[Id]
OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY
```
I am unclear whether this is a Syncfusion issue or if this is something to do with EFCore, but wanted to bring it up here first to determine the next steps.
Thank you for any continued assistance in this matter.
Hi Mike-E,
Thanks for your update.
We are unclear about the exact scenario or the issue you are facing. We need the following details to further analyze this scenario and provide you a suggestion as early as possible. Kindly get back to us with the following details for better assistance.
We would like to inform you that, by default when perform any data related action(like paging) in grid, then the ReadAsync method CustomAdaptor class will be triggered to refresh the data related changes in grid. In ReadAsync method, you can get the details of action in DataManagerRequest argument. So that you can customize the entire action based on request argument you get in DataManagerRequest inside the ReadAsync method. Please refer the below documentation for more details on custom adaptor feature.
https://blazor.syncfusion.com/documentation/datagrid/custom-binding
Please share with us the requested details to further analyze this scenario and provide you a suggestion as early as possible.
Regards,
Renjith R
Thank you for the request and update @Renjith. As it is unclear to me whether this is a Syncfusion or EFCore issue, and it is unclear to you from the outset here, I have opened an issue on EFCore's side to further investigate:
https://github.com/dotnet/efcore/issues/28387
I will update here when I have a better understanding and/or resolution on the matter.
Seems like this is a nothing-burger:
https://github.com/dotnet/efcore/issues/28387#issuecomment-1177373136
As such, I will mark this as the answer for now. Thank you for your time and efforts out there, @Renjith and team!