After creating this object
ClassName obj = new ClassName
{
Currency = "eur",
DateStart = DateTime.Now.AddDays(-1),
DateEnd = DateTime.Now.AddDays(-1)
};
and trying to validate it
var validationResults = Validation.Validate<ClassName>(obj);
I see this error, and I don’t figure out where to look and fix this:
An unhandled exception of type 'System.ArgumentException' occurred in
Microsoft.Practices.EnterpriseLibrary.Validation.dll
Additional information: Object must be of type Int32.
Any help is appreciated.
Thanks.
EDIT
Here seems to be the problem:
[RangeValidator(0f, RangeBoundaryType.Inclusive, 0f, RangeBoundaryType.Ignore, MessageTemplate = "...")]
public virtual double Price
{
get;
set;
}
You must have decorated some fields or properties of
ClassNamewithValidatorattributes. I assume that some of the attributes are either not applicable or you missed some parameters…