Reputation: 2030
I have searched a lot on the internet to find out the way to make constraints like The Customer Id should be a guid and required
so that I can end up with [HttpGet("{customerId:guid|required}")]
, but unluckily don't have any solution to do like this. The document from Microsoft at https://learn.microsoft.com/en-us/aspnet/core/fundamentals/routing, section Route Constraint Reference also doesn't shed light on this. Could anyone can do the multiple constraint values like what I just describe? Thank you in advance.
Upvotes: 3
Views: 1900
Reputation: 311
Simply separate the constraints with colons... {customerId:guid:required}
. Constraints that take parameters are also easy to use in this way... {id:int:range(100, 999)}
Upvotes: 5