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

Closed Issue: Consider adding an extension method for generating links to ApiController more easily [928]

$
0
0
Currently, generating a link for a controller extending ApiController involves the following method call:
```
Url.Link("DefaultApi", new { controller="products" id = value.Id });
```
The user needs to specify the "DefaultApi" string every time, which is error prone.
The controller token can be omitted, but it's a good rule to explicitly put it for clarity, and having it as a string is also error prone.

Consider adding an extension method that deals with Url generation for the default case:
```
Url.DefaultLink<ProductsController>(5);
```
or
```
Url.DefaultLink("products",5);
```
Comments: Closed after further investigation. It would involve an excessive coupling between the routing system and the controllers. It won't work if the user customizes the routing system.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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