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

Commented Issue: NRE when defining navigation property in derived type by explicit model builder [552]

$
0
0
Repro code is attached.
Send request: GET http://localhost:50232/vehicles to repro the issue

The exception is: System.NullReferenceException occurred
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=System.Web.Http.OData
StackTrace:
at System.Web.Http.OData.Builder.EntitySetLinkBuilderAnnotation.BuildNavigationLink(EntityInstanceContext context, IEdmNavigationProperty navigationProperty) in d:\git\WebStackRuntime\src\System.Web.Http.OData\OData\Builder\EntitySetLinkBuilderAnnotation.cs:line 124
InnerException:

The problem here is that when navigation property is added to derived type, model builder will try to add the same navigation property to it's base type. Because I didn't set HasNavigationPropertiesLink on base type, it will throw NRE. The solution here is to call HasNavigationPropertiesLink for all navigation properties from derived and base types. It is a good experience to me. Can we copy those navigation properties automatically?
Comments: http://aspnetwebstack.codeplex.com/SourceControl/changeset/b50db755d855

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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