Responsible for collecting together the actual method parameters and the parameters that need to be sent to the Execute method.
        /// <summary>
        /// Creates a set of FunctionImportParameter objects from the parameters passed in.
        /// </summary>
        public static IEnumerable <FunctionImportParameter> Create(IEnumerable <FunctionParameter> parameters, CodeGenerationTools code, MetadataTools ef)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (code == null)
            {
                throw new ArgumentNullException("code");
            }

            if (ef == null)
            {
                throw new ArgumentNullException("ef");
            }

            UniqueIdentifierService        unique           = new UniqueIdentifierService();
            List <FunctionImportParameter> importParameters = new List <FunctionImportParameter>();

            foreach (FunctionParameter parameter in parameters)
            {
                FunctionImportParameter importParameter = new FunctionImportParameter();
                importParameter.Source = parameter;
                importParameter.RawFunctionParameterName = unique.AdjustIdentifier(code.CamelCase(parameter.Name));
                importParameter.FunctionParameterName    = code.Escape(importParameter.RawFunctionParameterName);
                if (parameter.Mode == ParameterMode.In)
                {
                    TypeUsage typeUsage = parameter.TypeUsage;
                    importParameter.NeedsLocalVariable    = true;
                    importParameter.FunctionParameterType = code.GetTypeName(typeUsage);
                    importParameter.EsqlParameterName     = parameter.Name;
                    Type clrType = ef.UnderlyingClrType(parameter.TypeUsage.EdmType);
                    importParameter.RawClrTypeName = typeUsage.EdmType is EnumType?code.GetTypeName(typeUsage.EdmType) : code.Escape(clrType);

                    importParameter.IsNullableOfT = clrType.IsValueType;
                }
                else
                {
                    importParameter.NeedsLocalVariable    = false;
                    importParameter.FunctionParameterType = "ObjectParameter";
                    importParameter.ExecuteParameterName  = importParameter.FunctionParameterName;
                }
                importParameters.Add(importParameter);
            }

            // we save the local parameter uniquification for a second pass to make the visible parameters
            // as pretty and sensible as possible
            for (int i = 0; i < importParameters.Count; i++)
            {
                FunctionImportParameter importParameter = importParameters[i];
                if (importParameter.NeedsLocalVariable)
                {
                    importParameter.LocalVariableName    = unique.AdjustIdentifier(importParameter.RawFunctionParameterName + "Parameter");
                    importParameter.ExecuteParameterName = importParameter.LocalVariableName;
                }
            }

            return(importParameters);
        }
        /// <summary>
        /// Creates a set of FunctionImportParameter objects from the parameters passed in.
        /// </summary>
        public static IEnumerable<FunctionImportParameter> Create(IEnumerable<FunctionParameter> parameters, CodeGenerationTools code, MetadataTools ef)
        {
            if (parameters == null)
            {
            throw new ArgumentNullException("parameters");
            }

            if (code == null)
            {
            throw new ArgumentNullException("code");
            }

            if (ef == null)
            {
            throw new ArgumentNullException("ef");
            }

            UniqueIdentifierService unique = new UniqueIdentifierService();
            List<FunctionImportParameter> importParameters = new List<FunctionImportParameter>();
            foreach (FunctionParameter parameter in parameters)
            {
            FunctionImportParameter importParameter = new FunctionImportParameter();
            importParameter.Source = parameter;
            importParameter.RawFunctionParameterName = unique.AdjustIdentifier(code.CamelCase(parameter.Name));
            importParameter.FunctionParameterName = code.Escape(importParameter.RawFunctionParameterName);
            if (parameter.Mode == ParameterMode.In)
            {
                TypeUsage typeUsage = parameter.TypeUsage;
                importParameter.NeedsLocalVariable = true;
                importParameter.FunctionParameterType = code.GetTypeName(typeUsage);
                importParameter.EsqlParameterName = parameter.Name;
                Type clrType = ef.UnderlyingClrType(parameter.TypeUsage.EdmType);
                importParameter.RawClrTypeName = typeUsage.EdmType is EnumType ? code.GetTypeName(typeUsage.EdmType) : code.Escape(clrType);
                importParameter.IsNullableOfT = clrType.IsValueType;
            }
            else
            {
                importParameter.NeedsLocalVariable = false;
                importParameter.FunctionParameterType = "ObjectParameter";
                importParameter.ExecuteParameterName = importParameter.FunctionParameterName;
            }
            importParameters.Add(importParameter);
            }

            // we save the local parameter uniquification for a second pass to make the visible parameters
            // as pretty and sensible as possible
            for (int i = 0; i < importParameters.Count; i++)
            {
            FunctionImportParameter importParameter = importParameters[i];
            if (importParameter.NeedsLocalVariable)
            {
                importParameter.LocalVariableName = unique.AdjustIdentifier(importParameter.RawFunctionParameterName + "Parameter");
                importParameter.ExecuteParameterName = importParameter.LocalVariableName;
            }
            }

            return importParameters;
        }