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

Commented Unassigned: [ODataAttrRouting] $value support requires adding a route for it [1647]

$
0
0
_Scenario_: I am using OData Attribute routing on a property of an entity

Currently I need to have 2 routes for support regular request and $value based one, otherwise I get a 404 when i make a request for $value

```
[ODataRoute("Customers({key})/Name")]
[ODataRoute("Customers({key})/Name/$value")]
public async Task<IHttpActionResult> GetCustomerName(int key)
{
Customer customer = await context.Customers.FindAsync(key);
```

Ideally I would expect that specifying only the following route should be sufficient.

```
[ODataRoute("Customers({key})/Name")]
public async Task<IHttpActionResult> GetCustomerName(int key)
{
Customer customer = await context.Customers.FindAsync(key);
```
Comments: Agree usability could be improved here. But the current situation is better than implicitly supporting …/Customers(23)/Name/$value or …/Customers(23)/Name/$ref when the user only specified “…/Customers/({key})/Name” in their template. We should not enable options the user hasn’t explicitly requested. That said it’s worth talking about a feature to add something like a "next segment" bitmask property to the `[ODataRoute]` attribute.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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