Example #1
0
        /// <summary>
        /// Assumptions:
        ///     assembly that methodInfo is in has been loaded
        ///     the class the methodinfo is in has a parameterless constructor
        /// </summary>
        /// <param name="methodInfo"></param>
        public MethodCall(MethodInfo methodInfo, string identifier)
        {
            m_identifier = identifier;
            m_methodInfo = methodInfo;
            m_object     = Activator.CreateInstance(m_methodInfo.DeclaringType);

            ClassXsdGenerator generator = new ClassXsdGenerator();

            generator.NameGenerator += new NameGeneratorDelegate(generator_NameGenerator);
            m_baseName = "input";

            List <ParameterInfo> inputParameters = MethodCallTools.GetInputParameters(m_methodInfo);

            m_inputType    = MethodCallTools.CreateTypeFromParameters(inputParameters, m_methodInfo);
            m_inputSchemas = generator.GenerateSchema(m_inputType);
            m_inputSchema  = m_inputSchemas[0];

            generator = new ClassXsdGenerator();
            generator.NameGenerator += new NameGeneratorDelegate(generator_NameGenerator);
            m_baseName = "output";

            List <ParameterInfo> outputParameters = MethodCallTools.GetOutputParameters(m_methodInfo);

            m_outputType    = MethodCallTools.CreateTypeFromParameters(outputParameters, m_methodInfo);
            m_outputSchemas = generator.GenerateSchema(m_outputType);
            m_outputSchema  = m_outputSchemas[0];
        }
Example #2
0
        /// <summary>
        /// Convert a list of parameters to a schema that describes the parameters.
        /// </summary>
        /// <param name="parameters">parameters</param>
        /// <param name="methodInfo">Method </param>
        /// <returns></returns>
        public static XmlSchema ConvertParametersToSchema(List <ParameterInfo> parameters, MethodInfo methodInfo)
        {
            if (parameters.Count == 0)
            {
                return(null);
            }

            Type parameterType = MethodCallTools.CreateTypeFromParameters(parameters, methodInfo);

            XmlSchema         wrappedSchema = null;
            IList <XmlSchema> schemas       = MethodCallTools.GenerateSchema(parameterType);

            wrappedSchema = schemas[0];

            return(wrappedSchema);
        }