问题描述:

We're using RavenDB on the backend and so all the DB keys are strings that contain forward slashes e.g. users/1 in /api/users/1/foo.

This question superseeds this question for the previous version of the Web API.

The solution I came up with v1 works fine but it's a little messy setting up the tables. v2 introduces attribute routing which would be a very welcome change.

However, I could find no way to match parts of the URL that contain forward slashes. I tried creating a custom constraint but it seems that the pipeline will split the URL segments before trying to match it.

What's the simplest way to extend the URL => attribute matcher such that it can accept constraints that contain full-blown regexes (i.e. not regexes limited to one segment)?

相关阅读:
Top