title: Data annotation mapping to the property of the object
body: <p>I'm sorry if the title is not representative enough.</p>
  
  <p>So in my case, I want to build a more dynamic search form. Previously my search form only support <em>equal</em> operator. Now I want it to support another operators (contains, greater than etc).</p>
  
  <p>This is what my previous search form model looks like:</p>
  
  <pre><code>public class PersonQuery
  {
    [StringLength(100)]
    public string FirstName { get; set; }
    // the rest of the properties
  }
  </code></pre>
  
  <p>And now the new query model is look like this:</p>
  
  <pre><code>public class AdvPersonQuery
  {
    [StringLength(100)]
    public FilterField&lt;string&gt; FirstName { get; set; }
  }
  </code></pre>
  
  <p>where FilterField:</p>
  
  <pre><code>public class FilterField&lt;T&gt;
  {
    // in this case I want the [StringLength(100)] attribute 
    // or any other data annotation that is put on property that use this class to be used here
    public T Value { get; set; }
    public OperatorTypes Operator { get; set; }
  }
  </code></pre>
  
  <p>In this case I want the <em>Value</em> property data annotations refer to data annotations of property that use this class in the example above is <em>FirstName</em> property. So that when I put <em>Value</em> property of FirstName in View, the field will be validated based on the validation attribute defined on the FirstName property.</p>