C# Class FluentValidation.Validators.ScalePrecisionValidator

Allows a decimal to be validated for scale and precision. Scale would be the number of digits to the right of the decimal point. Precision would be the number of digits. It can be configured to use the effective scale and precision (i.e. ignore trailing zeros) if required. 123.4500 has an scale of 4 and a precision of 7, but an effective scale and precision of 2 and 5 respectively.
Inheritance: PropertyValidator
Datei anzeigen Open project: JeremySkinner/FluentValidation

Public Methods

Method Description
ScalePrecisionValidator ( int scale, int precision ) : System
ScalePrecisionValidator ( int scale, int precision, string errorMessage ) : System
ScalePrecisionValidator ( int scale, int precision, string errorMessageResourceName, Type errorMessageResourceType ) : System

Protected Methods

Method Description
IsValid ( PropertyValidatorContext context ) : bool

Private Methods

Method Description
GetBits ( decimal Decimal ) : System.UInt32[]
GetMantissa ( decimal Decimal ) : decimal
GetPrecision ( decimal Decimal ) : int
GetScale ( decimal Decimal ) : int
GetUnsignedScale ( decimal Decimal ) : uint
Init ( int scale, int precision ) : void
NumTrailingZeros ( decimal Decimal ) : uint

Method Details

IsValid() protected method

protected IsValid ( PropertyValidatorContext context ) : bool
context PropertyValidatorContext
return bool

ScalePrecisionValidator() public method

public ScalePrecisionValidator ( int scale, int precision ) : System
scale int
precision int
return System

ScalePrecisionValidator() public method

public ScalePrecisionValidator ( int scale, int precision, string errorMessage ) : System
scale int
precision int
errorMessage string
return System

ScalePrecisionValidator() public method

public ScalePrecisionValidator ( int scale, int precision, string errorMessageResourceName, Type errorMessageResourceType ) : System
scale int
precision int
errorMessageResourceName string
errorMessageResourceType System.Type
return System