Example #1
0
        public static object MaxValue(this DbType value)
        {
            switch (value)
            {
            case DbType.Boolean:
                return(1);

            case DbType.Byte:
                return(Byte.MaxValue);

            case DbType.Decimal:
                return(0);

            case DbType.Double:
                return(0);

            case DbType.Int16:
                return(Int16.MaxValue);

            case DbType.Int32:
                return(Int32.MaxValue);

            case DbType.Int64:
                return(Int64.MaxValue);

            case DbType.Single:
                return(Single.MaxValue);

            case DbType.UInt16:
                return(UInt16.MaxValue);

            case DbType.UInt32:
                return(UInt32.MaxValue);

            case DbType.UInt64:
                return(UInt64.MaxValue);

            case DbType.Date:
            case DbType.DateTime:
            case DbType.DateTime2:
                return("'6 Jun 2079'");    // note : small date time is 1 Jan 1900
            }


            return(value.IsNumericType() ? (object)Int32.MaxValue : (object)"'ZZZZZZZZZZZZZZZZ'");
        }
Example #2
0
        public static object MinValue(this DbType value)
        {
            switch (value)
            {
            case DbType.Boolean:
                return(0);

            case DbType.Byte:
                return(Byte.MinValue);

            case DbType.Decimal:
                return(0);    //Int32.MinValue; unknown precision

            case DbType.Double:
                return(0);    //Int32.MinValue; unknown precision

            case DbType.Int16:
                return(Int16.MinValue);

            case DbType.Int32:
                return(Int32.MinValue);

            case DbType.Int64:
                return(Int64.MinValue);

            case DbType.Single:
                return(Single.MinValue);

            case DbType.UInt16:
                return(UInt16.MinValue);

            case DbType.UInt32:
                return(UInt32.MinValue);

            case DbType.UInt64:
                return(UInt64.MinValue);

            case DbType.Date:
            case DbType.DateTime:
            case DbType.DateTime2:
                return("'1 Jan 1753'");    // note : small date time is 6 Jun 2079
            }


            return(value.IsNumericType() ? (object)Int32.MaxValue : (object)"''");
        }