How to specify a min but no max decimal using the range data annotation attribute?

后端 未结 10 1736
旧时难觅i
旧时难觅i 2021-01-31 01:02

I would like to specify that a decimal field for a price must be >= 0 but I don\'t really want to impose a max value.

Here\'s what I have so far...I\'m not sure what the

10条回答
  •  长发绾君心
    2021-01-31 01:16

    It seems there's no choice but to put in the max value manually. I was hoping there was some type of overload where you didn't need to specify one.

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

提交回复
热议问题