We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
I have a case where I want to sort on a grouped nested dynamic property.
However, the request fails and I get an exception.
Assemblies affected
Microsoft.AspNetCore.OData 8.2.5
Reproduce steps
Actual result
/customers
/customers?$apply=groupby((Address/City))
[ { "Address": { "City": "City 2" } }, { "Address": { "City": "City 1" } } ]
/customers?$apply=groupby((Address/City))&$orderby=((Address/City))
[ { "Address": { "City": "City 1" } }, { "Address": { "City": "City 2" } } ]
/customers?$apply=groupby((Address/DynamicCity))
[ { "Address": { "DynamicCity": "City 2" } }, { "Address": { "DynamicCity": "City 1" } } ]
/customers?$apply=groupby((Address/DynamicCity))&$orderby=((Address/DynamicCity))
System.ArgumentException: Instance property 'DynamicCity' is not defined for type 'Microsoft.AspNetCore.OData.Query.Wrapper.GroupByWrapper' (Parameter 'propertyName') at System.Linq.Expressions.Expression.Property(Expression expression, String propertyName) at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindDynamicPropertyAccessQueryNode(SingleValueOpenPropertyAccessNode openNode, QueryBinderContext context) at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindSingleValueNode(SingleValueNode node, QueryBinderContext context) at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.Bind(QueryNode node, QueryBinderContext context) at Microsoft.AspNetCore.OData.Query.Expressions.OrderByBinder.BindOrderBy(OrderByClause orderByClause, QueryBinderContext context) at Microsoft.AspNetCore.OData.Query.Expressions.BinderExtensions.ApplyBind(IOrderByBinder binder, IQueryable query, OrderByClause orderByClause, QueryBinderContext context, Boolean alreadyOrdered) at Microsoft.AspNetCore.OData.Query.OrderByQueryOption.AddOrderByQueryForProperty(IOrderByBinder orderByBinder, OrderByClause orderbyClause, IQueryable querySoFar, QueryBinderContext binderContext, Boolean alreadyOrdered) at Microsoft.AspNetCore.OData.Query.OrderByQueryOption.ApplyToCore(IQueryable query, ODataQuerySettings querySettings) at Microsoft.AspNetCore.OData.Query.OrderByQueryOption.ApplyTo(IQueryable query, ODataQuerySettings querySettings) at Microsoft.AspNetCore.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings) at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ApplyQuery(IQueryable queryable, ODataQueryOptions queryOptions) at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ExecuteQuery(Object responseValue, IQueryable singleResultCollection, ControllerActionDescriptor actionDescriptor, HttpRequest request) at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuted(ActionExecutedContext actionExecutedContext, Object responseValue, IQueryable singleResultCollection, ControllerActionDescriptor actionDescriptor, HttpRequest request) at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuted(ActionExecutedContext actionExecutedContext) at Microsoft.AspNetCore.Mvc.Filters.ActionFilterAttribute.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
Expected result
I would expect the following result for the fifth query :
[ { "Address": { "DynamicCity": "City 1" } }, { "Address": { "DynamicCity": "City 2" } } ]
The text was updated successfully, but these errors were encountered:
KenitoInc
xuzhg
No branches or pull requests
Hello,
I have a case where I want to sort on a grouped nested dynamic property.
However, the request fails and I get an exception.
Assemblies affected
Microsoft.AspNetCore.OData 8.2.5
Reproduce steps
Actual result
/customers
=> OK/customers?$apply=groupby((Address/City))
=> OK/customers?$apply=groupby((Address/City))&$orderby=((Address/City))
=> OK/customers?$apply=groupby((Address/DynamicCity))
=> OK/customers?$apply=groupby((Address/DynamicCity))&$orderby=((Address/DynamicCity))
=> NOKExpected result
I would expect the following result for the fifth query :
The text was updated successfully, but these errors were encountered: