Exemplo n.º 1
0
        protected override object GetParameterValue(IProviderType type, object value)
        {
            if (value == null)
            {
                return(DBNull.Value);
            }

            var type2 = value.GetType();

            //if (type2 == typeof(Guid))
            if (type == GuidType)
            {
                return(DBConvert.ChangeType(value, typeof(byte[])));
            }

            var closestRuntimeType = type.GetClosestRuntimeType();

            if (closestRuntimeType == typeof(OracleDecimal))
            {
                return(new OracleDecimal(Convert.ToDecimal(value)));
            }
            if (type2 == typeof(char) && closestRuntimeType == typeof(decimal))
            {
                value = DBConvert.ChangeType(value, typeof(int));
                return(DBConvert.ChangeType(value, closestRuntimeType));
            }
            return(closestRuntimeType == type2 ? value : DBConvert.ChangeType(value, closestRuntimeType));
        }
Exemplo n.º 2
0
        protected virtual object GetParameterValue(IProviderType type, object value)
        {
            if (value == null)
            {
                return(DBNull.Value);
            }

            var type2 = value.GetType();
            var closestRuntimeType = type.GetClosestRuntimeType();

            return(closestRuntimeType == type2 ? value : DBConvert.ChangeType(value, closestRuntimeType));
        }
Exemplo n.º 3
0
        protected override object GetParameterValue(IProviderType type, object value)
        {
            if (value == null)
            {
                return(DBNull.Value);
            }

            var type2 = value.GetType();
            var closestRuntimeType = type.GetClosestRuntimeType();

            if (closestRuntimeType == typeof(OracleNumber))
            {
                return(new OracleNumber(Convert.ToDecimal(value)));
            }
            return(closestRuntimeType == type2 ? value : DBConvert.ChangeType(value, closestRuntimeType));
        }