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

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

c# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -

c++ - Redefined variable in the other module -