Skip to content

Instantly share code, notes, and snippets.

@merken
Last active August 18, 2017 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merken/da46aeaf0ef79938f152af867cc3d9a2 to your computer and use it in GitHub Desktop.
Save merken/da46aeaf0ef79938f152af867cc3d9a2 to your computer and use it in GitHub Desktop.
Entity Framework Core: Data type 'nvarchar' is not supported in this form. Either specify the length explicitly in the type name, for example as 'nvarchar(16)', or remove the data type and use APIs such as HasMaxLength to allow EF choose the data type.
public class MyDbContext : MyContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<MyEntity>(entity =>
{
entity.Property(e => e.MyProperty)
.HasColumnType("nvarchar(4000)");
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment