-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
How to GroupBy Nullable DateTime Year? #424
Comments
@brainded |
@StefH Thank you! I tried: Is NP supported in the GroupBy method? Or just in the Where and Select methods? Seems like the examples using the NP operator are Objects with a property.... but this is a little different being a Nullable base type. |
Hello @brainded, I'll investigate. |
@StefH Might I suggest the following? Ordinarily,
into a ternary conditional:
But if any of the property checks (
This assumes it would be legal syntax to write:
even if
|
Hello @brainded Can you please test NuGet 1.2.7-preview-02 from https://www.myget.org/F/system-linq-dynamic-core/api/v3/index.json ? |
Dear @brainded, did you have time to test this? |
Dear @brainded, did you have time to test this? |
Dear @brainded, I'll close this issue and merge to fix to master. A new version will be released within a week. In case you still have questions or issues with the new release, just open a new Issue here. |
@StefH finally getting some time to return back to this after the holidays. updating now and will report back! Thank you for looking into it! |
I have tried the following to get the group by to work for this but I am having trouble getting past the nullable issues.
.GroupBy("new (NullableDate.Year)") throws an exception because the Year property doesn't exist. Makes sense because the property is actually on Value.
.GroupBy("new (NullableDate?.Year)") throws an exception that you can't use an NP with the library. I found the exception in the source code and I kinda get why that isn't supported.
.GroupBy("new (NullableDate.Value.Year)") works! But then fails to materialize results because the value returned should be nullable.
Is there a supported way to do what I am trying to do here? Or even an unsupported workaround?
The text was updated successfully, but these errors were encountered: