I am adding few tables to an existing database using Entity Framework code first and fluent API.
After going through SQL Server datetime2 vs datetime and Why You Should Never Use DATETIME Again!, I am mapping the DateTime properties to datetime2 using
mb.Entity<SomeClass>()
.Property(q => q.DateTimeTypePropety)
.HasColumnType("datetime2");
Forcing Entity Framework to use datetime2 data type is not an option as it will affect existing tables.
modelBuilder.Properties<DateTime>()
.Configure(c => c.HasColumnType("datetime2"));
Is there a fluent API syntax to do this for specific tables instead of mapping each property individually?
Thanks for your time.