Closed
Description
Description
There is no good way to filter by the parent with isnull or isnotnull operators.
If I have a class Child referencing the Parent, both use int as a Key, then I cannot use a filter query like this
api/children?filter[parent.id]=isnull:
— it fails to create the equality expression (because you can't compare int and null).
There are 2 bad workarounds for this right now:
- Add the [Attr] attribute to the Parent property of the Child and use the following filter instead
api/children?filter[parent]=isnull:
It causes the loading of the whole Parent hierarchy into attributes. - Change the Key type from int to Nullable. It's nonsense to have a nullable primary key.
Environment
- JsonApiDotNetCore Version: the current master branch
Metadata
Metadata
Assignees
Labels
No labels