ASP NET属性路由数组 [英] ASP NET attribute routing array

查看:81
本文介绍了ASP NET属性路由数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在为控制器使用属性路由,如下所示:

So I am using attribute routing for my controller like this:

    [Route("last/{id:int}")]
    public IHttpActionResult GetUpdateLast([FromUri] int id) { 
        return Ok();
    }

现在,我想将其转换为接受整数数组,在控制器参数中,我只需切换到[FromUri] int id[]即可,没有问题,但是,如何切换路由属性[Route("last/{id:int}")]使其接受一个数组整数?

Now I want to convert it to accept an array of integers, in the controller parameter I just switch to [FromUri] int id[] with no problems, however, how do I switch the route attribute [Route("last/{id:int}")] to make it accept an array of integers?

推荐答案

您在那里很困,无法使用路由来完成您想做的事情,因此请用作查询字符串:

Your were almoust there, there is no way of doing what you want using the route, so use as a query string :

这篇关于ASP NET属性路由数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆