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)); }
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); } }
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)); }