c# - Custom Attribute for the route -


I want to create a custom attribute, for the parameters in my path I can not use the "parameterbugging attribute"

Before "do something", I want to verify the parameter myVar

how to do this? Get the public IHttpActionResult ([myAttribute] int myVAR) {// Something}

Thanks

You can write an action filter that will inspect value.

  [VerifyMyVar] Public IHttpActionResult Get (Int myVar) {// TODO} Public Class VerifyMyVar: HttpActionFilterAttribute {...}  

If you are more specific If you want verification, you can inspect MethodInfo from the filter, and do something special with [MyAttribute] code inside.


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -