示例#1
0
        public static List <ActionMethod> GetActions(this Type serviceType)
        {
            var to = serviceType.GetMethods(BindingFlags.Public | BindingFlags.Instance)
                     .Where(x => x.GetParameters().Length == 1 && x.DeclaringType != typeof(Service) && !x.IsGenericMethod &&
                            ServiceController.IsServiceAction(x.Name, x.GetParameters()[0].ParameterType))
                     .Map(x => new ActionMethod(x));

            return(MergeAsyncActions(to));
        }
示例#2
0
        public static IEnumerable <MethodInfo> GetActions(this Type serviceType)
        {
            foreach (var mi in serviceType.GetMethods(BindingFlags.Public | BindingFlags.Instance))
            {
                if (!ServiceController.IsServiceAction(mi))
                {
                    continue;
                }

                yield return(mi);
            }
        }
示例#3
0
        public static List <ActionMethod> GetRequestActions(this Type serviceType, Type requestType)
        {
            if (!typeof(IService).IsAssignableFrom(serviceType))
            {
                throw new NotSupportedException("All Services must implement IService");
            }

            var to = serviceType.GetMethods(BindingFlags.Public | BindingFlags.Instance)
                     .Where(x => x.GetParameters().Length == 1 && x.GetParameters()[0].ParameterType == requestType && !x.IsGenericMethod &&
                            ServiceController.IsServiceAction(x.Name, x.GetParameters()[0].ParameterType))
                     .Map(x => new ActionMethod(x));

            return(MergeAsyncActions(to));
        }