title: How does the MetadataType attribute mark a class as a validation class in MVC?
body: <p>I have my ADO entity generated in MVC 2 and I know that if I want to put custom validation on an object I can do something like this.</p>
  
  <pre><code>[MetadataType(typeof(MyEntity_Validation))]
  public partial class MyEntity
  {
      private sealed class MyEntity_Validation
      {
          [Required]
          [RegularExpression("[A-Za-z][0-9]{5}")]
          public string SomeField{ get; set; }
  
      }
  }
  </code></pre>
  
  <p>But I don't know why that works.</p>
  
  <p>How does that work? Some sort of convention?</p>