This change makes it possible to override the default precision and scale for generated decimal schemas by setting the [Range] attribute on a field or property.
We can’t infer anything from the int or double overloads, so the annotation has to be of the form [Range(typeof(decimal), "0.00", "1.00"]. It’s sort of ugly, especially since ConvertValueInInvariantCulture should be set as well (as shown in the new fixture class), but it’s a legitimate way to set the range and jibes with our preference for built-in annotations instead of our own. This post has a good, if dated, description of the footguns.
This change makes it possible to override the default precision and scale for generated decimal schemas by setting the
[Range]
attribute on a field or property.We can’t infer anything from the
int
ordouble
overloads, so the annotation has to be of the form[Range(typeof(decimal), "0.00", "1.00"]
. It’s sort of ugly, especially sinceConvertValueInInvariantCulture
should be set as well (as shown in the new fixture class), but it’s a legitimate way to set the range and jibes with our preference for built-in annotations instead of our own. This post has a good, if dated, description of the footguns.