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

Commented Issue: Navigation properties incorrect deserialization of key when using string [706]

$
0
0
using latest nightly of System.Web.Http.OData. using ODataConventionModelBuilder() and EnableOData() with Entity Framework.<br /><br />When using a string as the key, links are generated as follows:<br /><br />~/Entities<br />~/Entities('key')<br /><br />and that's fine. However, when you try and use a navigation property, the link is as follows:<br /><br />~/Entities('key')/NavigationProperty<br /><br />and the string that is passed through to the controller action is "'key'" - it is wrapped in in the single quotes. this gets passed down to EF, (WHERE blah='''key''') and of course the query returns no results.<br /><br />The quotes are removed correctly when looking at an individual entity ~/Entities/('key') it seems, so there appears to be an oversight in the deserialization.
Comments: Ah. the GetNavigationProperty() needs the [FromODataUri] adding to the key: public IQueryable<T> GetNavigationProperty([FromODataUri] TKey key) Feel free to close (but do also feel free to produce some up to date documentation!)

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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