-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MudDataGrid: Add extensions method on IQueryable
for easy filtering and ordering
#8254
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #8254 +/- ##
==========================================
+ Coverage 88.82% 88.99% +0.17%
==========================================
Files 407 409 +2
Lines 12226 12252 +26
Branches 2441 2447 +6
==========================================
+ Hits 10860 10904 +44
+ Misses 834 819 -15
+ Partials 532 529 -3 ☔ View full report in Codecov by Sentry. |
b541646
to
8513134
Compare
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.
Maybe NRT can be enable on this file? Like you did in QuerySortExtensions.cs.
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.
Good point! I did in in f60b021, rebased on the dev
branch and force-pushed.
8513134
to
407e00c
Compare
Hey @0xced, thanks for your pull request, I currently struggled to find a way to do those queries user friendly. For myself I would like that extension to be a bit more powerful. Would you consider to implement an solution where its possible to query for included class structures, like for example extend the MemberExpression for each member of depth? |
I am not sure I understand... |
@vernou I tested it with my own class structures with EF on SQLite successfully. Example Column for MudDataGrid Class example
A "solution" would be sth like this. But I dont know if its the best way to go.
|
Hi, thanks for the PR. @mikes-gh I think it's very problematic for us that this is not trim compatible because of this line
if SortDefinition contained the type information of the property it would be, since there is an overload that accepts type info.Honestly, I'm not sure what to do with this PR, tho I like the idea. I will @tjscience let to decide. |
407e00c
to
d2f91fc
Compare
@Militancy I think I figured out a way to support your scenario. Instead of adding one extension method, I added two extension methods (and force pushed my branch). The new one that I added takes an additional @ScarletKuro I don't think that's a problem since the type |
d2f91fc
to
2c675f1
Compare
Description
This pull request introduces two new extensions methods on
IQueryable
:Where
that takes aIEnumerable<IFilterDefinition<T>>
andOrderBy
that takes aIEnumerable<SortDefinition<T>>
.This enables a straightforward implementations of the
ServerData
function, for example with EF Core.(A good implementation would need to order the source with a default ordering in case the sort definitions are empty.)
It also fixes #6682.
How Has This Been Tested?
Two new unit tests have been added:
QueryFilterExtensionTest
andQuerySortExtensionTest
.Types of changes
Checklist:
dev
).