FirebirdDecFloatToTextResolver
A class used to resolve the value of a Firebird DECFLOAT column, as returned by the driver, into its text form.
This IResolver<object, string> implementation converts the value of a DECFLOAT(16) or DECFLOAT(34) column, as returned by the FirebirdSql.Data.FirebirdClient driver, into its text form. The driver returns an FbDecFloat, but a decimal or a string is accepted as well. It is used by the FirebirdDecFloatToStringPropertyHandler and, through the FirebirdDecFloatToDecimalResolver, by the decimal property handlers.
- A
nullorDBNullvalue is resolved asnull. - A
stringis returned as is. - A
decimalis formatted with the invariant culture. - An
FbDecFloatis formatted in its plain form (e.g.123.45, and not the12345E-2scientific form the driver produces for a negative exponent). When the value has more than 28 digits, which is more than adecimalcan hold, the scientific form is returned as is so that the precision is never altered.
An ArgumentException is thrown when the type of the value is not supported.
Usability
var resolver = new FirebirdDecFloatToTextResolver();
var text = resolver.Resolve(reader.GetValue(0)); // "123.45"