The library itself is split into namespaces which are based on rough vertical markets/domains.
  • Within each of these, there is a XXXAlgorithm class for each validation logic/routine; these all follow a similar implementation design (specifically they all inherit from StringValidationAlgorithm / Int32ValidationAlgorithm which in turn implement IValidationAlgorithm<string> * IValidationAlgorithm<int>).
  • There is then a matching XXXAttribute class which derives from ValidationAlgorithmAttribute (which in turn derives from System.ComponentModel.ValidationAttribute) and provides the wrapper logic to connect the validation logic to the the System.ComponentModel architecture.
  • Most algorithms also contain one or more static methods which are specific to their logic for things such as extracting/inferring country codes (see) / card types (see) from a correctly formatted value.

Unit Tests

There is also a System.ComponentModel.DataAnnotations.VSUnitTests project which contains extensive positive and negative tests for validating each algorithm and any special methods. Visual Studio Metrics measure test coverage varies between 65 and 88% and a maintainability index of 85.


These validators perfom basic checksum validation and are primarily designed to be leveraged by the more complex domain specific validators (ie the PaymentCardNumberValidator uses the LuhnMod10CheckDigitAlgorithm as one step of its own validation logic).


'Commerce/logistics' domain specific validation algorithms.


'Financial' domain specific validation algorithms.

Last edited Nov 12, 2009 at 1:08 AM by markscottjohnson, version 4


No comments yet.