Best Data annotation for a Decimal(18,2)

后端 未结 8 1306
無奈伤痛
無奈伤痛 2020-12-14 05:57

I have a column inside my sql server 2008 wih type of Decimal(18,2). But on entity framework what is the best data annotation validation I can apply to this pro

8条回答
  •  孤城傲影
    2020-12-14 06:52

    Im using almost excplusively (b/c it's simple and works)

    [Range(typeof(decimal), "0", "1")]
    public decimal Split { get; set; }
    

    Then if I need to convert back to double I add a conversion

    (double)model.Split
    

提交回复
热议问题