title: EF Code First 4.1 doesn't support nvarchar(max) at all?
body: <p>I've spent decent amount of time on this problem and still can't figure out why EF team makes the life so hard using Code First.</p>
  
  <p><strong>So here is some sample:</strong></p>
  
  <p>My POCO:</p>
  
  <p>The way I want the thing to look like:</p>
  
  <pre><code>public class Post
  {
       public int Id {get; set;}
       public string Text {get; set;}
  }
  
  protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
      modelBuilder.Entity&lt;Post&gt;()
          .Property(p =&gt; p.Text)
          .HasColumnType("nvarchar(max)");   
  }
  </code></pre>
  
  <p>The only thing that works:</p>
  
  <pre><code>public class Post
  {
       public int Id {get; set;}
  
       [StringLength(4000)]
       public string Text {get; set;}
  }
  </code></pre>
  
  <p>The problem is that when in first case I try to insert anything it gives me: <code>Validation failed for one or more entities</code> and the second case doesn't fit my business model. </p>
  
  <p>Am I the only one with this problem? How do I deal with this thing?</p>