title: Data Validation Design Patterns
body: <p>If I have a collection of database tables (in an Access file, for example) and need to validate each table in this collection against a rule set that has both common rules across all tables as well as individual rules specific to one or a subset of tables, can someone recommend a good design pattern to look into?</p>
  
  <p>Specifically, I would like to avoid code similar to:</p>
  
  <pre><code>void Main()
  {
      ValidateTable1();
      ValidateTable2();
      ValidateTable3();
  }
  
  private void ValidateTable1()
  {
      //Table1 validation code goes here
  }
  
  private void ValidateTable2()
  {
      //Table2 validation code goes here
  }
  
  private void ValidateTable3()
  {
      //Table3 validation code goes here
  }
  </code></pre>
  
  <p>Also, I've decided to use log4net to log all of the errors and warnings, so that each method can be declared <code>void</code> and doesn't need to return anything.  Is this a good idea or would it be better to create some sort of <code>ValidationException</code> that catches all exceptions and stores them in a <code>List&lt;ValidationException&gt;</code> before printing them all out at the end?</p>
  
  <p>I did find <a href="http://www.hickorysystems.com/sw_validation.html" rel="noreferrer">this</a>, which looks like it may work, but I'm hoping to actually find some code samples to work off of.  Any suggestions?  Has anyone done something similar in the past?</p>
  
  <p>For some background, the program will be written in either C# or VB.NET and the tables will more than likely be stored in either Access or SQL Server CE.</p>