title: MVC3 Dynamic DataAnnotation attribute StringLength
body: <p><strong>UPDATE #3: Entire question</strong></p>
  
  <p>I have a class HB:</p>
  
  <pre><code>    public class HB
  {
      public int Id { get; set; }
  
      [StringLength(3000)]
      public string Text { get; set; }
      public Title Title { get; set; }
  
  }
  </code></pre>
  
  <p>And Title:</p>
  
  <pre><code>    public class Title
  {
      public int Id { get; set; }
      public string Name { get; set; }
      public int MaxChar { get; set; }   
  }
  </code></pre>
  
  <p>Before you can write a HB (which is kind of an article), you have to choose your title, so your StringLength for HB.Text can be determined. Meaning, this article can only have a certain amount of chars, deppending on what 'Title' the writer has. Example: Title1 can only write a 'HB' with 1000 chars, and Title2 can write a 'HB' with 3000 chars. So. Thats means the the <code>StringLength</code> has to come from <code>Title.MaxChar</code>. Whats the smartest way to do that? </p>
  
  <p>The Title entity is prefixed data that will be stored in the db.</p>
  
  <p>To be crystal clear, what I want to achieve is something in the line with: <code>[StringLength(Title.MaxChar)]</code> </p>
  
  <p>Ive done structure/design for this mechanism in Webforms a million times, my brain just cant addapt to mvc, so some help would be appreciated. Code would be even more appreciated.</p>