How to implement the field decimal(5,2) in EntityFrameworkCore 1.0 rc2?

前端 未结 3 1138
我寻月下人不归
我寻月下人不归 2020-12-29 02:29

How to implement the field decimal(5,2) in EntityFrameworkCore 1.0 rc2 ?

HasPrecision seems to be not available anymore?

3条回答
  •  时光取名叫无心
    2020-12-29 03:17

    JFYI, if somedoby is stil comming to this question (like I did)

    In the current version of EF Core (2.2) there is also the Data Annotation way to do this:

    public class SomeEFModelClass
    {
        [Column(TypeName = "decimal(5,2)")]
        public decimal TotalScore{ get; set; }
    }
    

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

提交回复
热议问题