【问题标题】:How to get id from paths in Grapevine如何从 Grapevine 中的路径获取 id
【发布时间】:2022-01-09 16:51:06
【问题描述】:

这是一个简单的问题,但我没有找到任何文档。葡萄藤4.2.2

        //GET id
        [RestRoute(HttpMethod = HttpMethod.GET, PathInfo = "/api/[id]")]
        public IHttpContext GetDataId(IHttpContext context)
        {
            //how to get id?
        }

【问题讨论】:

    标签: c# rest grapevine


    【解决方案1】:

    一旦你写了一个问题,答案就会出现。

        //GET id
        [RestRoute(HttpMethod = HttpMethod.GET, PathInfo = "/api/[id]")]
        public IHttpContext GetDataId(IHttpContext context)
        {
            var id = context.Request.PathParameters["id"];
        }
    

    https://gist.github.com/scottoffen/af9cac93dd1c26440690d9a768ca1117

    为什么 Grapevine 没有正常的文档?

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2019-04-12
    • 2019-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-14
    • 1970-01-01
    • 2021-03-31
    相关资源
    最近更新 更多