You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Validation via aspect (should be attributes)

The ValidationAspects library defines an Extension method on object:

public static ValidationResult Validate(this object instance);

This method uses attributes like

[GreaterThan] and [ValidationMethod]

To create a ValidationResult with validation errors.

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

  • No labels