title: Set EF6 Code First strings fluently to nvarchar(max)
body: <p>I'm building an EF6 code first model using the fluent API. My understanding is, by default, strings will be <code>nvarchar(max)</code>, which (to be blunt) is dumb for a default. So I added the following convention code to set max default length to 255 characters:</p>
  
  <pre><code>modelBuilder.Properties&lt;string&gt;()
      .Configure(p =&gt; p.HasMaxLength(255));
  </code></pre>
  
  <p>Then I created a decorator like so:</p>
  
  <pre><code>[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
  public class TextAttribute : Attribute
  {
  }
  </code></pre>
  
  <p>I want to apply this to specific string properties that I actually want to be <code>NVARCHAR(MAX)</code>.</p>
  
  <p>What do I put in the fluent API to make sure all string properties with the <code>[Text]</code> decorator are built in the database with <code>NVARCHAR(MAX)</code>?  I assume it would be something like this:</p>
  
  <pre><code>modelBuilder.Properties&lt;string&gt;()
      .Where(p =&gt; p.CustomAttributes.Any(a =&gt; typeof(TextAttribute).IsAssignableFrom(a.AttributeType)))
      .Configure(p =&gt; p.HasMaxLength(?????));
  </code></pre>
  
  <p>Or am I doing this completely wrong?</p>