protected ReflectedProviderFactoryDefinitionBase(MethodBase method,
                                                         QualifiedName qname,
                                                         Type outputType)
        {
            this.qname = qname;
            this.outputType = outputType;
            this.method = method;

            this.parameters = new PropertyDefinitionCollection();
            parameters.AddRange(this, qname.NamespaceName, method.GetParameters(), method.IsExtension());
        }
        public CommonReflectionInfo(OperatorDefinition def, RoleAttribute attr, MethodBase method)
        {
            this.method = method;
            this.def = def;
            this.name = attr.ComputeName(method);

            var type = method.DeclaringType;
            if (type.IsGenericType && !type.IsGenericTypeDefinition)
                type = type.GetGenericTypeDefinition();

            this.ns = TypeHelper.GetNamespaceName(type);
            parameters = new PropertyDefinitionCollection();
            parameters.AddRange(def, ns, method.GetParameters(), method.IsExtension());
        }
        internal static object[] MapParameters(MethodBase ctor, object parent, IReadOnlyDictionary<string, object> parameters)
        {
            ParameterInfo[] parms = ctor.GetParameters();
            int index = 0;
            object[] args = new object[parms.Length];

            if (ctor.IsExtension()) {
                args[0] = parent;
                index = 1;
            }

            for (; index < parms.Length; index++) {
                ParameterInfo p = parms[index];
                args[index] = parameters[p.Name];
            }

            return args;
        }