Search code examples
entity-framework-4ef4-code-onlyentity-framework-ctp5

EF4 CTP5 - HasColumnType not working


I want to override the default nvarchar(4000) for one of my string columns to a text data type in SQL Express. I use this code.

modelBuilder.Entity<Accommodation>()
               .Property(p => p.Information)
               .HasColumnType("text");

But the column type remains as nvarchar?

I also asked here http://social.msdn.microsoft.com/Forums/en/adonetefx/thread/a1d84ea9-2f8e-42f0-bb83-ac9f68805d6d?prof=required


Solution

  • Ahh I just figured it out, adding the fluent mapping was not sufficient to force the table to dropAndCreate itself again even though I had DropCreateDatabaseIfModelChanges set.

    I had to force it to update the table manually.