Loop/reflect through all properties in all EF Models to set Column Type

前端 未结 2 1631
走了就别回头了
走了就别回头了 2020-11-27 07:32

My client has a standard of storing SQL Server decimals with a decimal(13,4) specification. As a result, in a very large and still-growing schema, I have nearly a hundred st

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 08:25

    New feature will be introduced in EF Core 5.0

    modelBuilder
        .Entity()
        .Property(b => b.Numeric)
        .HasPrecision(16, 4);
    

    Reference : https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-5.0/whatsnew#preview-4

提交回复
热议问题