开发者

Can we use validator class in method parameter with validation application block?

开发者 https://www.devze.com 2023-02-23 22:11 出处:网络
I am using validation application block and new in this. My question is that can we give the validator class to method pa开发者_Go百科rameter? like used it with WCF

I am using validation application block and new in this. My question is that can we give the validator class to method pa开发者_Go百科rameter? like used it with WCF

public void getTaskList([some validator class] String number) { ....}

Regards, Girish


imho you should not use a validation framework on simple parameters since they are the contract for the method.

It's just as throwing an ArgumentNullException if parameter User owner is null and then to validation on the actual User object.

If you need validation, put all method arguments in a class and validate that class.

0

精彩评论

暂无评论...
验证码 换一张
取 消