protected Type GetParameterUrtType(DesignParameter parameter)
 {
     if (this.ParameterOption == ParameterGenerationOption.SqlTypes)
     {
         return(this.GetParameterSqlType(parameter));
     }
     if (this.ParameterOption != ParameterGenerationOption.Objects)
     {
         if (this.ParameterOption != ParameterGenerationOption.ClrTypes)
         {
             throw new InternalException("Unknown parameter generation option.");
         }
         Type type = null;
         if (((parameter.DbType == DbType.Time) && (this.methodSource != null)) && ((this.methodSource.Connection != null) && StringUtil.EqualValue(this.methodSource.Connection.Provider, ManagedProviderNames.SqlClient, true)))
         {
             type = typeof(TimeSpan);
         }
         else
         {
             type = TypeConvertions.DbTypeToUrtType(parameter.DbType);
         }
         if (type != null)
         {
             return(type);
         }
         if (this.codeGenerator != null)
         {
             this.codeGenerator.ProblemList.Add(new DSGeneratorProblem(System.Design.SR.GetString("CG_UnableToConvertDbTypeToUrtType", new object[] { this.MethodName, parameter.Name }), ProblemSeverity.NonFatalError, this.methodSource));
         }
     }
     return(typeof(object));
 }
        private Type GetParameterSqlType(DesignParameter parameter)
        {
            IDesignConnection connection = null;

            if (!StringUtil.EqualValue(connection.Provider, ManagedProviderNames.SqlClient))
            {
                throw new InternalException("We should never attempt to generate SqlType-parameters for non-Sql providers.");
            }
            SqlDbType sqlDbType = SqlDbType.Char;
            bool      flag      = false;

            if ((parameter.ProviderType != null) && (parameter.ProviderType.Length > 0))
            {
                try
                {
                    sqlDbType = (SqlDbType)Enum.Parse(typeof(SqlDbType), parameter.ProviderType);
                    flag      = true;
                }
                catch
                {
                }
            }
            if (!flag)
            {
                SqlParameter parameter2 = new SqlParameter {
                    DbType = parameter.DbType
                };
                sqlDbType = parameter2.SqlDbType;
            }
            Type type2 = TypeConvertions.SqlDbTypeToSqlType(sqlDbType);

            if (type2 != null)
            {
                return(type2);
            }
            if (this.codeGenerator != null)
            {
                this.codeGenerator.ProblemList.Add(new DSGeneratorProblem(System.Design.SR.GetString("CG_UnableToConvertSqlDbTypeToSqlType", new object[] { this.MethodName, parameter.Name }), ProblemSeverity.NonFatalError, this.methodSource));
            }
            return(typeof(object));
        }