Disable automatic validation on properties set

Jul 16, 2009 at 11:55 PM

is there any way not to validate the value on set, and only get the result when calling the Validate() method?

Jul 17, 2009 at 12:05 AM

found the answer,

don't use [Validate] only apply the attribute to the properties not the class.

 

Coordinator
Jul 17, 2009 at 8:05 AM

That's correct. By placing [Validate] on a type you are declaring the type's methods and properties should be intercepted for validation. If you just require state validation across your entire project you do not need to use the [Validate] attribute nor have a dependency on ValidationAspects.PostSharp and PostSharp. If you do want interception validation on methods but not properties, decorate your type with [Validate] and set to false ValidationAspects.ValidationSettings.InterceptValidateProperties to false.