I need to create a route constraint, but this constraint needs to use one of my services, and this service method uses async.
Now ideally, the data that is returned from this routeConstraint, i would like to pass to the controller for use within the action that is being called, if the constraint has been met.
Users will call a controller with an extra parameter, we will call myName. if this value appears in the database, i would like that record in the controller method.
Path to call controller looks like so, where data is the name of my controller, and myName is a string, that i need to check if it exists in the database.
http://localhost/api/data/myName
If myName doesnt exist, the controller should not be called. If it does, then the method should be called, but with the myName value available.
Not sure if maybe i need to use something else then a route constraint?
NOTE: I cannot add this as a parameter against each method in this controller, so please do not suggest it.