-
-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataGrid: change total items from int to long #5902
base: next-2.0
Are you sure you want to change the base?
DataGrid: change total items from int to long #5902
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is quite straightforward so there is not too complex things to review. We just need to document it for the user.
And also, write migration notes and release notes.
...zorise.Docs/Pages/Docs/Extensions/DataGrid/Examples/DataGridAggregatesLargeDataExample.razor
Outdated
Show resolved
Hide resolved
...tation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Examples/DataGridLargeDataExample.razor
Outdated
Show resolved
Hide resolved
@tesar-tech can you please merge |
…from-int-to-long # Conflicts: # Demos/Blazorise.Demo/Pages/Tests/DataGrid/DataGridPage.razor.cs # Demos/Blazorise.Demo/Pages/Tests/DataGrid/PagerPage.razor # Documentation/Blazorise.Docs/Pages/Docs/Extensions/DataGrid/Examples/DataGridPagerExample.razor # Source/Extensions/Blazorise.DataGrid/Contexts/PaginationContext.cs # Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs # Source/Extensions/Blazorise.DataGrid/DataGridState.cs # Source/Extensions/Blazorise.DataGrid/EventArguments/DataGridPageChangedEventArgs.cs # Source/Extensions/Blazorise.DataGrid/_DataGridPagination.razor
Now with the ExpressionCompiler there is the long to int conversion issue again. I hid it for now, but it's suboptimal solution. It boils down to Warning in case of larger datasets? Some Skip implementation under the hood? Removing the "problematic" overload? Currently there are just comments. |
|
I'd just personally make everything long. Realistically the price you pay is negligible and makes the api handle a wider number of cases. We could always take some inspiration from other libraries also. |
That is already decided, but it has some issues with changes introduced in your recent PR. |
Can you clarify? Isn't the attribute there an int and can't we also change it to long? Maybe I'm not getting it. |
I believe the problem is that in Linq, some of the methods cannot receive the |
I have asked ChatGPT is it possible to implement custom extension methods and translate it into a valid SQL. Note that I haven't tried this in the code. Step 1 public static class QueryableExtensions
{
public static IQueryable<T> SkipLong<T>(this IQueryable<T> source, long count)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
if (count > int.MaxValue)
throw new ArgumentOutOfRangeException(nameof(count), "Count exceeds int.MaxValue, which is not supported by LINQ.");
return source.Skip((int)count);
}
} Step 2
Step 3
Step 4
If this works there might be a way around it. Now, I don't think we should do this in our code. We can provide our users with a guide on how to do this in their own projects. Write a blog post or documentation page. We could even create a separate project that does it for them, like |
Yeah, I was here—trying to figure out a way to support This whole
Adding this information to the documentation is an option, but it feels like a way to sidestep the real problem rather than addressing it properly. ...
One potential solution could be introducing a separate component, like |
The way I see it. Long-to-int internal conversion should not be a problem. Nobody will load over 2 billion of data in memory to show it in the data grid. So doing the Only once they use our ReadData API they are going to need to implement their own ways of reading outside data. And in this moment the |
But the The original dataset inside the demo is a |
Description
Closes #5170
Supporting larger datasets than int.MaxValue isn't just about changing
int
tolong
...First, the issue with Virtualize needs to be addressed.
Breaking changes
Changing
TotalItems
tolong
also requires to change all the datatypes around it. For example forPager
. AlsoTotalPages
are nowlong
. Which leads to some breaking changes in user code. The biggest one I think is the inability to do:because the result in
Skip
is nowlong
and skip doesn't support long↑ Solution is shortsighted, because it will overflow "soon". That's why I include all such changes in one commit (we can revert them easily)..
Also all the custom pagers will have to be upgraded to use long instead of int. And probably many more places too.
Current PR state
Overall it works and we can support quite huge datasets. Check the DataGridLargePage.razor .
Possible solution:
From all this I think we should take another approach:
Internally handle everything in longs, as is the current state of the pr.
Expose the "public getter only properties" also with ints, in their original names (CurrentPage, LastVisiblePage, etc):
Rename the "working" public getters with
*Long
suffix.Probably
TotalItems
should still belong
.Vast majority of users don't need the
long
support. I would say - don't force it to them => less breaking changes for current users.Who really wants the
long
support has to change to the*Long
properties - no big deal.Todos