Skip to content
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

Fixed: error setting default sort for non-string properties #754

Merged
merged 1 commit into from
May 14, 2020
Merged

Fixed: error setting default sort for non-string properties #754

merged 1 commit into from
May 14, 2020

Conversation

bart-degreed
Copy link
Contributor

Fixes the problem described at #741 (comment).

The issue is that the specified expression gets wrapped in a type conversion expression on non-string properties, making the code unable to 'see' through the single field.

Unfortunately this code is shared between GetDefaultSortOrder and HideFields, making it possible to specify multiple fields in a single ordering (which makes no sense at all).

@bart-degreed
Copy link
Contributor Author

@fdlane does this solve your issue?

@fdlane
Copy link
Contributor

fdlane commented May 14, 2020

@bart-degreed the non-string properties now sort with correctly. Thank you!

      public override PropertySortOrder GetDefaultSortOrder() => new PropertySortOrder
      {
        (t => t.InvoiceDate, SortDirection.Descending)
      };

@bart-degreed bart-degreed merged commit 87f05f2 into json-api-dotnet:master May 14, 2020
@bart-degreed bart-degreed deleted the default-sort-type-conversion branch May 14, 2020 13:35
@bart-degreed bart-degreed mentioned this pull request May 18, 2020
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants