In EntityFramework 6 I could do something like the following to change the defaults for a particular data type:
protected override void OnModelCreating(
DbModelBuilder mb
) {
mb
.Properties<DateTime>()
.Configure(config =>
config
.HasColumnType("datetime2")
.HasPrecision(7)
);
This saves having to specify these details for every single DateTime
property in the DB.
Is there an equivalent way of changing property defaults in EF Core? There is no such Properties
member on the EF Core ModelBuilder
type.