How to map SQL Server text column with Entity Framework Core 2.0 Model property

entity-framework entity-framework-core sql

Accepted Answer

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Blog>(eb =>
    {
        eb.Property(b => b.Url).HasColumnType("ntext");
        eb.Property(b => b.ModernUrl).HasColumnType("nvarchar(MAX)");
    });
}

https://docs.microsoft.com/en-us/ef/core/modeling/relational/data-types

1
12/6/2017 5:23:58 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow