Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: QueryableAttribute can't work with property from parent class [344]

$
0
0
For example:
public class Person
{
public Address Address { get; set; }
}
public class Employee : Person
{
}

When returning IEnumerable<Employee> in action, it won't work with QueryableAttribute by reporting following exception:
System.ArgumentException occurred
Message=The property does not belong to the specified type.
Parameter name: navigationProperty
Source=System.Web.Http.OData
ParamName=navigationProperty
StackTrace:
at System.Web.Http.OData.Builder.EntityTypeConfiguration.AddNavigationProperty(PropertyInfo navigationProperty, EdmMultiplicity multiplicity) in C:\dd\DevDiv\Offcycle\WPT\WebStackRuntime\runtime\src\System.Web.Http.OData\OData\Builder\EntityTypeConfiguration.cs:line 68
InnerException:
> System.Web.Http.OData.dll!System.Web.Http.OData.Builder.EntityTypeConfiguration.AddNavigationProperty(System.Reflection.PropertyInfo navigationProperty, Microsoft.Data.Edm.EdmMultiplicity multiplicity) Line 74 C#
System.Web.Http.OData.dll!System.Web.Http.OData.Builder.ODataConventionModelBuilder.MapEntityType(System.Web.Http.OData.Builder.IEntityTypeConfiguration entity) Line 197 C#
System.Web.Http.OData.dll!System.Web.Http.OData.Builder.ODataConventionModelBuilder.MapTypes() Line 160 C#
System.Web.Http.OData.dll!System.Web.Http.OData.Builder.ODataConventionModelBuilder.GetEdmModel() Line 87 C#
System.Web.Http.OData.dll!System.Web.Http.HttpActionDescriptorExtensions.GetEdmModel.AnonymousMethod__0(object _) Line 31 C#
mscorlib.dll!System.Collections.Concurrent.ConcurrentDictionary<object,object>.GetOrAdd(object key, System.Func<object,object> valueFactory)
System.Web.Http.OData.dll!System.Web.Http.HttpActionDescriptorExtensions.GetEdmModel(System.Web.Http.Controllers.HttpActionDescriptor actionDescriptor, System.Type entityClrType) Line 26 C#
System.Web.Http.OData.dll!System.Web.Http.QueryableAttribute.OnActionExecuted(System.Web.Http.Filters.HttpActionExecutedContext actionExecutedContext) Line 132 C#
MvcWebApi.ODataTests.dll!MvcWebApi.ODataTests.QueryComposition.ServerTypeTests.RunQueryableOnAllPossibleTypes(System.Type type) Line 83 C#

Comments: No longer repro

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>