I have two values in a Model
, specifying the minimum and maximum balance.
I want to know if there is a way to set the limitation within the Model
that enforces the values to have MinBalance
between 0 and MaxBalance
, and have MaxBalance
between MinBalance
and Double.MaxValue
.
Currently I have:
/// <summary>
/// Gets or sets the min value.
/// </summary>
/// <value>
/// The min value.
/// </value>
[Range(0.0, Double.MaxValue)]
public decimal MinBalance { get; set; }
/// <summary>
/// Gets or sets the max value.
/// </summary>
/// <value>
/// The max value.
/// </value>
[Range(0.0, Double.MaxValue)]
public decimal MaxBalance { get; set; }
I wanted to do something like this:
/// <summary>
/// Gets or sets the min value.
/// </summary>
/// <value>
/// The min value.
/// </value>
[Range(0.0, MaxBalance)]
public decimal MinBalance { get; set; }
/// <summary>
/// Gets or sets the max value.
/// </summary>
/// <value>
/// The max value.
/// </value>
[Range(MinBalance, Double.MaxValue)]
public decimal MaxBalance { get; set; }
Sadly, the latter gives me an error on using the variables in the Range, as it does not pick them up.