title: Generate ntext/nvarchar column when using Entity Framework Code First and a DBMigration
body: <p>I'd like to either using the Fluent API or data annotations be able to automatically generate a database migration class for a string column as an <code>ntext</code> rather than a fixed length string. How would I do that?</p>
  
  <p>When using Entity Framework v6, with Code First, and SQL Server Compact 4, given a simple C# class such as:</p>
  
  <pre><code>public class GameFile
  {
      public string Id { get; set; }        
      public string FileData { get; set; }
      public int FileSize { get; set; }
  }
  </code></pre>
  
  <p>Then, when adding a new migration:</p>
  
  <pre><code>add-migration first
  </code></pre>
  
  <p>the resulting migration class defaults to a <code>string</code> column of maximum length <code>4000</code>.</p>
  
  <pre><code>CreateTable(
      "dbo.GameFiles",
      c =&gt; new
          {
              Id = c.String(nullable: false, maxLength: 4000),
              FileData = c.String(maxLength: 4000),
              FileSize = c.Int()
          })
      .PrimaryKey(t =&gt; t.Id);
  </code></pre>
  
  <p>When the database is updated via <code>update-database</code>, the table will have a column named <code>FileData</code> of type <code>nvarchar(4000)</code>.</p>
  
  <p>I've tried adding an attribute of <code>MaxLength</code> and/or <code>Column</code> to the <code>FileData</code> property, but there's no change in the generated migration code. </p>
  
  <pre><code>[MaxLength, Column(TypeName = "ntext")]
  public string FileData { get; set; }
  </code></pre>
  
  <p>I know if I manually edit the migration code to explicitly declare the <code>storeType</code>:</p>
  
  <pre><code>FileData = c.String(storeType: "ntext")
  </code></pre>
  
  <p>that the resulting table is created properly.</p>