An Asp.Net Validation Framework (Part 2)
In the first part , we saw how to create custom attributes and rules. Now we'll look at how to implement those attributes. The IValidatable interface defines how consumers can interact with the framework. It indicates that we'll have a collection of BrokenRules and offers a method to perform validation. ValidatableBase implements IValidatable and does most of the work. Your classes simply inherit from ValidatableBase and they are completely functional. You decorate all of the properties you want. /// <summary> /// Interface for class that wish to implement /// validation. /// </summary> public interface IValidatable { /// <summary> /// Gets the collection of business rules that have /// been broken. /// </summary> BrokenRulesCollection BrokenRules { get; } /// <summary> /// Validates the objects. /// </summary> /// <param name="clearBrokenRules">Indicates if the Broken...