private MethodInfo GetInvokerMethod(StringSegment name, int argsCount) { var method = GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public) .FirstOrDefault(x => name.EqualsIgnoreCase(x.Name) && x.GetParameters().Length == argsCount && (argsCount == 0 || x.GetParameters()[0].ParameterType != typeof(TemplateScopeContext))); return(method); }
private MethodInfo GetContextInvokerMethod(StringSegment name, int argsCount) { var method = GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public) .FirstOrDefault(x => name.EqualsIgnoreCase(x.Name) && x.GetParameters().Length == argsCount && x.GetParameters()[0].ParameterType == typeof(TemplateScopeContext)); if (method != null && method.ReturnType != typeof(Task)) { throw new NotSupportedException($"Filter '{name}' with scope context does not have a Task return type"); } return(method); }