Uri Hendler - 404 - Sep 12, 2014

Is there any way to tell from a request DTO if a request filter attribute exists on the service method?

It’s straightforward to find the attributes directly on the DTO by calling dtoType.AllAttributes<CustomRequestFilterAttribute>(), but this doesn’t help if the request filter attribute is on the service method, e.g.:
[CustomRequestFilter]
public object Post(HelloRequest request) { }

As far as I can tell, the ServiceExec<TService> class is the only place where request/response filter attributes are queried (from the MethodInfo of the service method).

The FilterAttributeCache.GetRequestFilterAttributes only returns attributes on the class level (DTO or service), not on the method level.

No there’s no public API for it, it’s maintained internally in ServiceExec<T> https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/Host/ServiceExec.cs#L46
If you just want to find out what Action attributes there are you’re better off reflecting off the Service Type yourself, there’s a public serviceType.GetActions() ext method that can help. But if you want to execute the action filters like a normal request than you call ServiceController.Execute() as in: http://stackoverflow.com/a/25282718/85785