コード例 #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TSqlDecimalNullValue" /> class.
        /// </summary>
        /// <param name="precision">The maximum total number of decimal digits that will be stored, both to the left and to the right of the decimal point. The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.</param>
        /// <param name="scale">The maximum number of decimal digits that can be stored to the right of the decimal point. Scale must be a value from 0 through p. The default scale is 0.</param>
        public TSqlDecimalNullValue(TSqlDecimalPrecision precision, TSqlDecimalScale scale)
        {
            if (scale > precision)
            {
                throw new ArgumentOutOfRangeException("scale", scale,
                                                      string.Format("The scale ({0}) must be less than or equal to the precision ({1}).", scale, precision));
            }

            _precision = precision;
            _scale     = scale;
        }
コード例 #2
0
 /// <summary>
 ///     Returns a DECIMAL parameter value.
 /// </summary>
 /// <param name="value">The parameter value</param>
 /// <param name="precision">The parameter precision.</param>
 /// <param name="scale">The parameter scale.</param>
 /// <returns>A <see cref="IDbParameterValue" />.</returns>
 public IDbParameterValue Decimal(decimal?value, TSqlDecimalPrecision precision, TSqlDecimalScale scale)
 {
     if (!value.HasValue)
     {
         return(new TSqlDecimalNullValue(precision, scale));
     }
     return(new TSqlDecimalValue(value.Value, precision, scale));
 }