Skip to content

ReferencePropertyValidator

crmckenzie edited this page Apr 26, 2012 · 4 revisions

Used to validate reference properties. This validator is most easily used through the Fluent Properties API.

Sample

            yield return Properties<Employee>
                .For(e => e.Address)
                .Required()
                .Cascade("Save")
                ;
  • Cascade() - Will execute Validator.Validate and aggregate the results where T is the type of the value of the property.
  • Cascade<T> - will execute Validator.Validate and aggregate the results where T is a supertype of the value of the property.
  • DoNotCascade() - Will not call Validator.Validate and aggregate the results for the property value.
  • If() - specifies a condition under which the validator will be executed.
  • Required() - Indicates that the property value cannot be null.
  • NotRequired() - Indicates that the property can be null. If null, Cascade() will not be called.
  • Message() - Specifies the message to be returned if the validation fails.
  • Severity() - Specifies the severity of the ValidationResult if the validator fails.
  • Type() - Specifies the type of the ValidationResult if the validator fails.
Clone this wiki locally