Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Validation via aspect (should be attributes)

The ValidationAspects library defines an Extension method on object:

Code Block
public static ValidationResult Validate(this object instance);

This method uses attributes like

Code Block
[GreaterThan] and [ValidationMethod]

To create a ValidationResult with validation errors. So you can validate any object and all the validation rules defined on that object with be tested.

Using PostSharp with these aspect enables throwing validation expections on setter.