C# odata v4无法在另一个复杂类型中选择复杂类型的属性(使用扩展)

C# odata v4无法在另一个复杂类型中选择复杂类型的属性(使用扩展),c#,json,select,odata,expand,C#,Json,Select,Odata,Expand,我有一个模型,上面有项目(根),然后是复杂类型(制造),嵌入了另一个复杂类型(位置,下面名为工厂) 在扩大生产时,一切都按预期进行: https://localhost/Inextrace/Items('ABC123456789')?$select=Code&$expand=Manufacturing($select=Factory) 但是,当我尝试只选择复杂类型位置(Factory)的一个属性时,它表示不支持该属性。有什么解决办法来实现这一点吗 https://localhost/I

我有一个模型,上面有项目(根),然后是复杂类型(制造),嵌入了另一个复杂类型(位置,下面名为工厂)

在扩大生产时,一切都按预期进行:

https://localhost/Inextrace/Items('ABC123456789')?$select=Code&$expand=Manufacturing($select=Factory)
但是,当我尝试只选择复杂类型位置(Factory)的一个属性时,它表示不支持该属性。有什么解决办法来实现这一点吗

https://localhost/Inextrace/Items('ABC123456789')?$select=Code&$expand=Manufacturing($select=Factory/Code)
响应:

{
  "error":{
    "code":"","message":"The query specified in the URI is not valid. A path within the select or expand query option is not supported.","innererror":{
      "message":"A path within the select or expand query option is not supported.","type":"Microsoft.OData.Core.ODataException","stacktrace":"   at System.Web.OData.Formatter.Serialization.SelectExpandNode.ValidatePathIsSupported(ODataPath path)\r\n   at System.Web.OData.Query.Expressions.SelectExpandBinder.GetPropertiesToIncludeInQuery(SelectExpandClause selectExpandClause, IEdmEntityType entityType, IEdmEntitySet entitySet, IEdmModel model, ISet`1& autoSelectedProperties)\r\n   at System.Web.OData.Query.Expressions.SelectExpandBinder.ProjectElement(Expression source, SelectExpandClause selectExpandClause, IEdmEntityType entityType, IEdmEntitySet entitySet)\r\n   at System.Web.OData.Query.Expressions.SelectExpandBinder.BuildPropertyContainer(IEdmEntityType elementType, Expression source, Dictionary`2 propertiesToExpand, ISet`1 propertiesToInclude, ISet`1 autoSelectedProperties, Boolean isSelectingOpenTypeSegments)\r\n   at System.Web.OData.Query.Expressions.SelectExpandBinder.ProjectElement(Expression source, SelectExpandClause selectExpandClause, IEdmEntityType entityType, IEdmEntitySet entitySet)\r\n   at System.Web.OData.Query.Expressions.SelectExpandBinder.GetProjectionLambda()\r\n   at System.Web.OData.Query.Expressions.SelectExpandBinder.Bind(IQueryable queryable)\r\n   at System.Web.OData.Query.SelectExpandQueryOption.ApplyTo(IQueryable queryable, ODataQuerySettings settings, IAssembliesResolver assembliesResolver)\r\n   at System.Web.OData.Query.ODataQueryOptions.ApplySelectExpand[T](T entity, ODataQuerySettings querySettings)\r\n   at System.Web.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)\r\n   at System.Web.OData.EnableQueryAttribute.ExecuteQuery(Object response, HttpRequestMessage request, HttpActionDescriptor actionDescriptor)\r\n   at System.Web.OData.EnableQueryAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)"
    }
  }
}
有没有办法只选择工厂的某些领域

我正在使用C#.Net和以下版本的nuget软件包:

  • Microsoft.AspNet.OData v5.8.0
  • Microsoft.OData.Code v6.14.0
  • Microsoft.AspNet.WebApi v5.2.3
问候,, 尼古拉斯·斯图比