private static void SetInValueInternal <TValue, TKey>(this OracleParametersWrapper <TKey> paramWrapper, TKey key, object value, ParameterDirection pDir = ParameterDirection.Input)
        {
            value = value ?? DBNull.Value;

            if (paramWrapper.ContainsKey(key))
            {
                paramWrapper[key].Value = value;
            }
            else
            {
                var p = new OracleParameter
                {
                    Direction     = pDir,
                    ParameterName = "@par_" + key
                };

                var type = typeof(TValue);

                switch (Type.GetTypeCode(type))
                {
                case TypeCode.Int16:
                    p.OracleDbType = OracleDbType.Int16;
                    break;

                case TypeCode.Int32:
                    p.OracleDbType = OracleDbType.Int32;
                    break;

                case TypeCode.Int64:
                    p.OracleDbType = OracleDbType.Int64;
                    break;

                case TypeCode.Decimal:
                    p.OracleDbType = OracleDbType.Decimal;
                    break;

                case TypeCode.Double:
                    p.OracleDbType = OracleDbType.Double;
                    break;

                case TypeCode.String:
                    p.OracleDbType = OracleDbType.Varchar2;
                    break;

                case TypeCode.DateTime:
                    p.OracleDbType = OracleDbType.Date;
                    break;

                case TypeCode.Boolean:
                    p.OracleDbType = OracleDbType.Boolean;
                    break;

                default:
                    throw new ArgumentException("Error to map specified type to an OracleDbType.");
                }

                p.Value           = value;
                paramWrapper[key] = p;
            }
        }
        private static void SetInValueInternalWithOdbType <TKey>(this OracleParametersWrapper <TKey> paramWrapper, TKey key, object value, OracleDbType odbType, ParameterDirection pDir = ParameterDirection.Input)
        {
            value = value ?? DBNull.Value;

            //aggiorno
            if (paramWrapper.ContainsKey(key))
            {
                paramWrapper[key].Value = value;
            }
            else
            {
                var p = new OracleParameter
                {
                    Direction     = pDir,
                    ParameterName = "@par_" + key,
                    OracleDbType  = odbType,
                    Value         = value,
                };
                paramWrapper[key] = p;
            }
        }
        public static object GetValue <TKey>(this OracleParametersWrapper <TKey> paramWrapper, TKey key, TypeCode type)
        {
            object value = null;

            if (paramWrapper.ContainsKey(key))
            {
                switch (type)
                {
                case TypeCode.Int16:
                    if (paramWrapper[key].OracleDbType != OracleDbType.Int16)
                    {
                        ThrowArgumentException(key, paramWrapper[key].OracleDbType);
                    }
                    value = ((short)(OracleDecimal)paramWrapper[key].Value);
                    break;

                case TypeCode.Int32:
                    if (paramWrapper[key].OracleDbType != OracleDbType.Int32)
                    {
                        ThrowArgumentException(key, paramWrapper[key].OracleDbType);
                    }
                    value = ((int)(OracleDecimal)paramWrapper[key].Value);
                    break;

                case TypeCode.Int64:
                    if (paramWrapper[key].OracleDbType != OracleDbType.Int64)
                    {
                        ThrowArgumentException(key, paramWrapper[key].OracleDbType);
                    }
                    value = ((long)(OracleDecimal)paramWrapper[key].Value);
                    break;

                case TypeCode.Decimal:
                    if (paramWrapper[key].OracleDbType != OracleDbType.Decimal)
                    {
                        ThrowArgumentException(key, paramWrapper[key].OracleDbType);
                    }
                    value = ((decimal)(OracleDecimal)paramWrapper[key].Value);
                    break;

                case TypeCode.Double:
                    if (paramWrapper[key].OracleDbType != OracleDbType.Double)
                    {
                        ThrowArgumentException(key, paramWrapper[key].OracleDbType);
                    }
                    value = ((double)(OracleDecimal)paramWrapper[key].Value);
                    break;

                case TypeCode.String:
                    var odbType = paramWrapper[key].OracleDbType;
                    if (odbType != OracleDbType.Varchar2 ||
                        odbType != OracleDbType.NVarchar2 ||
                        odbType != OracleDbType.Char ||
                        odbType != OracleDbType.NChar ||
                        odbType != OracleDbType.Clob ||      //CLOB is a string
                        odbType != OracleDbType.NClob ||
                        odbType != OracleDbType.XmlType        //XML is a string
                        )
                    {
                        ThrowArgumentException(key, paramWrapper[key].OracleDbType);
                    }
                    value = ((string)(OracleString)paramWrapper[key].Value);
                    break;

                case TypeCode.DateTime:
                    if (paramWrapper[key].OracleDbType != OracleDbType.Date)
                    {
                        ThrowArgumentException(key, paramWrapper[key].OracleDbType);
                    }
                    value = ((DateTime)(OracleDate)paramWrapper[key].Value);
                    break;

                case TypeCode.Boolean:
                    if (paramWrapper[key].OracleDbType != OracleDbType.Boolean)
                    {
                        ThrowArgumentException(key, paramWrapper[key].OracleDbType);
                    }
                    value = ((bool)(OracleBoolean)paramWrapper[key].Value);
                    break;

                case TypeCode.DBNull:
                    //will return default value
                    break;

                //IMPLEMENT OTHER TYPES HERE

                //if (paramWrapper[key].OracleDbType != OracleDbType.Boolean)
                //    throwArgumentException(key, paramWrapper[key].OracleDbType);
                //value = ((bool)(OracleBoolean)paramWrapper[key].Value);
                //break;
                default:
                    throw new ArgumentException($"Not a valid TypeCode {type}");
                }
                return(value);
            }
            else
            {
                throw new DataException(string.Format($"Output parameter key {key} does not exist"));
            }
        }