In EF6 i could use the following code so that all my dates use datetime2(0) as the column type
modelBuilder.Properties<DateTime>()
.Configure(c => c
.HasColumnType("datetime2")
.HasPrecision(0));
How can i do this in EFCore??
In EF6 i could use the following code so that all my dates use datetime2(0) as the column type
modelBuilder.Properties<DateTime>()
.Configure(c => c
.HasColumnType("datetime2")
.HasPrecision(0));
How can i do this in EFCore??
You need to install the Nuget Package: Microsoft.EntityFrameworkCore.SqlServer. After install, you can use HasColumnType("datetime") in your property. :)