title: Data Annotations - Range attribute with long type
body: <p>I have an ASP.NET Dynamic Data Web Site</p>
  
  <p>I'm scaffolding the model to apply validation</p>
  
  <p>I have some <code>bigint</code> fields and I'm suing SQL Server 2008</p>
  
  <p>My context represents correctly my <code>bigint</code> fields using <code>long</code> types:</p>
  
  <pre><code>public System.Nullable&lt;long&gt; ProcessorAffinityMask64Bit
  </code></pre>
  
  <p>I try to apply validation as follows:</p>
  
  <pre><code>[Range(typeof(long), "0", "4294967295")]
  public object ProcessorAffinityMask { get; set; }
  </code></pre>
  
  <p>I have also tried:</p>
  
  <pre><code>[Range(0, 4294967295)]
  public object ProcessorAffinityMask { get; set; }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>[Range(0D, 4294967295D)]
  public object ProcessorAffinityMask { get; set; }
  </code></pre>
  
  <p>But in any case I receive the following error:</p>
  
  <blockquote>
    <blockquote>
      <p>Value was either too large or too small for an Int32.</p>
    </blockquote>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/ktIn8.png" alt="enter image description here"></p>
  
  <p><strong>So How can I validate a long field?</strong></p>