How to use method parameter attributes

前端 未结 3 526
故里飘歌
故里飘歌 2021-01-04 05:58

I\'ve been struggling to find examples of how to write a custom attribute to validate method parameters, i.e., turn this form:

public void DoSomething(Client         


        
3条回答
  •  不知归路
    2021-01-04 06:43

    Attributes probably should be put on the method itself. When I was searching for the solution I found the following link and the way it uses interceptor seems even better http://www.codinginstinct.com/2008/05/argument-validation-using-attributes.html

提交回复
热议问题