Skip to content

Regression with computed in $orderby with Microsoft.AspNetCore.OData versions >= 8.0.5: "Could not find a property named 'computedProp' on type" error #1483

@andy-clymer

Description

@andy-clymer

Assemblies affected

This issue is similar to #1416

The issue occurs in Microsoft.AspNetCore.OData versions starting from 8.0.5 and up. The last known working version is 8.0.4.

Describe the bug

A regression occurs when using $orderby=COMPUTED_PROP_NAME in OData queries. The query that worked in Microsoft.AspNetCore.OData version 8.0.4 now fails in versions 8.0.5 and later.

Reproduce steps

  1. Create a new ASP.NET Core Web API project with OData setup.
  2. Add the Microsoft.AspNetCore.OData NuGet package version 8.0.4.
  3. Add a computed parameter to your query string and reference it in the orderby parameter:
GET http://localhost:5050/odata/MyEntities?$compute=age add 10 as agePlusTen&$orderby=agePlusTen desc&$select=id, name, agePlusTen&$filter=agePlusTen ge 21

This query works successfully in version 8.0.4, but fails in all subsequent versions. In all version the computed field works in $select and $filter, but $orderby doesn't work after 8.0.4

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions