title: Specify max length when declaring string field key with the Entity Framework 6.1 IndexAttribute attribute?
body: <p>I have an Entity Framework model (class) with a string property that I want to use as a key field.  I have tried defining the property like this:</p>
  
  <pre><code>[IndexAttribute("SourceText", IsUnique=true)]
  public string SourceText { get; set; }
  </code></pre>
  
  <p>This results in an SQL run-time error complaining that the property is invalid for use as a key field.  I understand why, because unique keys must not be more than 8000 characters and string fields are potentially a lot longer than this.  So, is there a way to tell EF that I don't need more than the first 500 characters from the field that is to be used as a key?</p>