کتابخانه drum
نویسنده: وحید محمدطاهری
تاریخ: ۱۳۹۵/۰۸/۲۸ ۱۹:۱۷
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
Drum is a little library for building URIs to ASP.NET Web API actions, using direct routes and lambda expressions. It provides an alternative to the UrlHelper class. Instead of requiring a route name and a set of name-value pairs, Drum allows the creation of URIs using actions invocations.
// using UrlHelper
var uri1 = _urlHelper.Link("GetPaged", new { page = 0, count = 10 });
// using UriMaker
var uri2 = _uriMaker.UriFor(c => c.GetPaged(0, 10)); where GetPaged is a Web API controller action
[RoutePrefix("api/UriMakerTests/resources")]
public class ResourceController : ApiController
{
[Route("", Name="GetPaged")]
public HttpResponseMessage GetPaged(int page, int count) {...}
...
}