【发布时间】:2016-07-23 02:12:55
【问题描述】:
我想在我的应用中定义以下路线:
/s/customers/1234/summary
和
/s/locations/5767/summary
现在通常我会像这样定义我的路线:
Add<CustomerSummaryRequest>("/s/customers/{Id}/summary")
Add<LocationSummaryRequest>("/s/locations/{Id}/summary")
但是问题是,我的数据库中客户和位置的 ID 本身就是
/customers/1234
/locations/5767
并最终希望拥有这些路线:
Add<CustomerSummaryRequest>("/s/{CustomerId*}/summary")
Add<LocationSummaryRequest>("/s/{LocationId*}/summary")
有什么建议吗?
我意识到我可以做到:
Add<CustomerSummaryRequest>("/s/Customers/{CustomerId*}/summary")
Add<LocationSummaryRequest>("/s/Locations/{LocationId*}/summary")
这会给我 id 的数字部分。然后我可以将 id 与 customers/ 或 /locations/ 结合起来
【问题讨论】:
标签: servicestack