Esempio n. 1
0
        /// <summary>
        /// Establece los parametros para la conexión actual. Es necesario para los valores de tipo BLOB
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        private List <Oracle.DTO.OracleParameter> GetParametersForCurrentContext(List <Oracle.DTO.OracleParameter> parameters, OracleConnection context)
        {
            var finalParameters = new List <Oracle.DTO.OracleParameter>();

            try
            {
                if (parameters != null)
                {
                    for (int i = 0; i < parameters.Count; i++)
                    {
                        if (parameters[i].OracleDbType.Equals(Oracle.DTO.OracleDbType.Blob) &&
                            parameters[i].Value != null &&
                            parameters[i].Value.GetType().Equals(typeof(byte[])))
                        {
                            var value = (byte[])parameters[i].Value;

                            var blob = new OracleBlob(context);
                            blob.Erase();
                            blob.Write(value, 0, value.Length);

                            parameters[i] = new Oracle.DTO.OracleParameter(parameters[i].ParameterName, Oracle.DTO.OracleDbType.Blob, blob, parameters[i].Direction);
                        }

                        finalParameters.Add(parameters[i]);
                    }
                }
            }
            catch (Exception er)
            {
                log.Error("GetParametersForCurrentContext()", er);
            }


            return(finalParameters);
        }
Esempio n. 2
0
        private static Oracle.ManagedDataAccess.Client.OracleParameter ToOracle(this Oracle.DTO.OracleParameter parameter)
        {
            Oracle.ManagedDataAccess.Client.OracleParameter result = null;

            if (parameter != null)
            {
                object type = null;

                result = new OracleParameter()
                {
                    ParameterName = parameter.ParameterName,
                    Value         = parameter.Value,
                    Direction     = parameter.Direction,
                    OracleDbType  = parameter.OracleDbType.ToOracle()
                };
            }

            return(result);
        }