You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindPropertyAccessExpression fails when a query is applied on List<DynamicEdmEntityObject>
#861
Getting an error trying to apply query on List
where queryOptions is a {Microsoft.AspNetCore.OData.Query.ODataQueryOptions<Hexagon.SmartApi.Model.DynamicEdmEntityObject>}
Request example: {{url}}?$filter=Name eq 'xxx'
Code example:
var result = new List();
...
var clrType = typeof(DynamicEdmEntityObject);
var queryOptions = query.Request.ODataQuery().MakeGeneric(clrType);
fails on: dynamic items = queryOptions.ApplyTo(result.AsQueryable());
Error:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Microsoft.AspNetCore.OData
StackTrace:
at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindPropertyAccessExpression(SingleValueOpenPropertyAccessNode openNode, PropertyInfo prop, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindDynamicPropertyAccessQueryNode(SingleValueOpenPropertyAccessNode openNode, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindConvertNode(ConvertNode convertNode, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindBinaryOperatorNode(BinaryOperatorNode binaryOperatorNode, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.FilterBinder.BindFilter(FilterClause filterClause, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.BinderExtensions.ApplyBind(IFilterBinder binder, IQueryable query, FilterClause filterClause, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)
at Hxgn.Schematics.Admin.WebApi.Service.Data.SiteRepository.d__9.MoveNext() in D:\hexagonppm\SEM\Git\SEM Web API\Sources\Admin WebAPI Grpc\Sources\Hxgn.Schematics.Admin.WebApi\Hxgn.Schematics.Admin.WebApi.Service\Data\SiteRepository.cs:line 661
It worked successfully with
queryOptions {System.Web.OData.Query.ODataQueryOptions<Intergraph.WebApi.Core.Model.DynamicEdmEntityObject>}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi There,
Getting an error trying to apply query on List
where queryOptions is a {Microsoft.AspNetCore.OData.Query.ODataQueryOptions<Hexagon.SmartApi.Model.DynamicEdmEntityObject>}
Request example: {{url}}?$filter=Name eq 'xxx'
Code example:
var result = new List();
...
var clrType = typeof(DynamicEdmEntityObject);
var queryOptions = query.Request.ODataQuery().MakeGeneric(clrType);
fails on: dynamic items = queryOptions.ApplyTo(result.AsQueryable());
Error:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Microsoft.AspNetCore.OData
StackTrace:
at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindPropertyAccessExpression(SingleValueOpenPropertyAccessNode openNode, PropertyInfo prop, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindDynamicPropertyAccessQueryNode(SingleValueOpenPropertyAccessNode openNode, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindConvertNode(ConvertNode convertNode, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.QueryBinder.BindBinaryOperatorNode(BinaryOperatorNode binaryOperatorNode, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.FilterBinder.BindFilter(FilterClause filterClause, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.Expressions.BinderExtensions.ApplyBind(IFilterBinder binder, IQueryable query, FilterClause filterClause, QueryBinderContext context)
at Microsoft.AspNetCore.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)
at Hxgn.Schematics.Admin.WebApi.Service.Data.SiteRepository.d__9.MoveNext() in D:\hexagonppm\SEM\Git\SEM Web API\Sources\Admin WebAPI Grpc\Sources\Hxgn.Schematics.Admin.WebApi\Hxgn.Schematics.Admin.WebApi.Service\Data\SiteRepository.cs:line 661
It worked successfully with
queryOptions {System.Web.OData.Query.ODataQueryOptions<Intergraph.WebApi.Core.Model.DynamicEdmEntityObject>}
Please advise with help.
Beta Was this translation helpful? Give feedback.
All reactions