Skip to content

Fixed: Sorting by ID from a lambda expression fails with error #1151

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

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

bkoelman
Copy link
Member

@bkoelman bkoelman commented Apr 6, 2022

Fixed: Sorting by ID from a lambda expression in a resource definition fails with error:

Type 'JsonApiDotNetCore.Resources.Identifiable`1[System.Int64]' does not exist in the resource graph.

The reason for failure is that in an expression like book => book.Id, the Id property is declared on Identifiable<>. The fix is to look at the type of the containing expression (which is Book in this case) when the Id property is used.

Affected versions: v5.0

QUALITY CHECKLIST

…n fails with error: Type 'JsonApiDotNetCore.Resources.Identifiable`1[System.Int64]' does not exist in the resource graph.

The reason for failure is that in an expression like `book => book.Id`, the `Id` property is declared on `Identifiable<>`. The fix is to look at the type of the containing expression (which is `Book` in this case) when the `Id` property is used.
@bkoelman bkoelman added the bug label Apr 6, 2022
@bkoelman bkoelman merged commit 4dc8115 into master Apr 6, 2022
@bkoelman bkoelman deleted the fix-lambda-sort-by-id branch April 6, 2022 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

1 participant