looking really for some advice on how i should handle the following scenario.
i have a inputviewmodel with a decimal field. the value will be inserted into a SQL db with the following precision and scale: 18,2.
if the user enters 100000000000000000.00 an error is returned from the db:
“Parameter value
‘100000000000000000.00’ is out of
range.”
How should i be handling this?i.e. to stop the user from entering this value. i do have a validation layer.. but this value does parse into a decimal.
many thanks in advance
You could decorate the property in your InputViewModel with a Range attribute.
MSDN doc on RangeAttribute for your InputViewModel:
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.rangeattribute.aspx
you’ll be looking for a usage like:
[Range(Maximum: 100000000)]