Beispiel #1
0
        protected void RegisterPublicMethods(String key, Type type)
        {
            XmlRpcServiceAttribute serviceAttr = (XmlRpcServiceAttribute)Attribute.GetCustomAttribute(type, typeof(XmlRpcServiceAttribute), true);

            if (key == null)
            {
                key = (serviceAttr == null) ? type.Name : serviceAttr.Name;
            }

            Dictionary <String, MethodInfo[]> map = new Dictionary <String, MethodInfo[]>();

            foreach (Type itf in type.GetInterfaces())
            {
                if (itf == typeof(IXmlRpcHandler))
                {
                    _handlers[key] = new DefaultXmlRpcHandler(this, TargetProviderFactory == null ? null : TargetProviderFactory.GetTargetProvider(type));
                    continue;
                }

                foreach (MethodInfo mi in itf.GetMethods())
                {
                    RegisterMethod(map, mi, key, type);
                }
            }

            foreach (MethodInfo mi in type.GetMethods())
            {
                RegisterMethod(map, mi, key, type);
            }

            foreach (var pair in map)
            {
                _handlers[pair.Key] = NewXmlRpcHandler(type, pair.Value);
            }
        }
        protected void RegisterPublicMethods(String key, Type type)
        {
            XmlRpcServiceAttribute serviceAttr = (XmlRpcServiceAttribute)Attribute.GetCustomAttribute(type, typeof(XmlRpcServiceAttribute), true);
            if (key == null)
                key = (serviceAttr == null) ? type.Name : serviceAttr.Name;

            Dictionary<String, MethodInfo[]> map = new Dictionary<String, MethodInfo[]>();

            foreach (Type itf in type.GetInterfaces())
            {
                if (itf == typeof(IXmlRpcHandler))
                {
                    _handlers[key] = new DefaultXmlRpcHandler(this, TargetProviderFactory == null ? null : TargetProviderFactory.GetTargetProvider(type));
                    continue;
                }
                
                foreach (MethodInfo mi in itf.GetMethods())
                {
                    RegisterMethod(map, mi, key, type);
                }
            }

            foreach (MethodInfo mi in type.GetMethods())
            {
                RegisterMethod(map, mi, key, type);
            }

            foreach (var pair in map)
            {
                _handlers[pair.Key] = NewXmlRpcHandler(type, pair.Value);
            }
        }