Closed sergey-litvinov-work closed 4 years ago
I don't think it's possible in the current approach as we are checking for base generic type PagedResult<>
and current one would be some specific typed instance like CustomPagedResult<string>
that can't be casted to base one. We can do cast to base only if we know about specific GenericType that was used to made inheritor, then it would work
Like here - https://dotnetfiddle.net/dTGKr8
so it's either manually check full hierarchy for typeless generic PagedResult<>
or create PagedResult
for specific generic type, and then use type.IsAssignableFrom
Hey Jouke,
Sorry, but it's another PR for another missing thing :) we tried to use custom PagedResult class. We use it like
And then for JSON.API it won't display TotalPages, but for regular JSON it will display that TotalPages field too plus properties in the base class.
The problem is my initial code in
PagedResuleQuery.IsPagedResult
was checking for specific type but it should also check the base classes too. I've fixed it in this PR and added unit test to cover that scenario tooThanks!