public SourceResolverDescriptor(Type sourceType, FieldMember field) { SourceType = sourceType ?? throw new ArgumentNullException(nameof(sourceType)); Field = field ?? throw new ArgumentNullException(nameof(field)); if (field.Member is MethodInfo m) { Arguments = FieldResolverDiscoverer .DiscoverArguments(m, sourceType); IsAsync = typeof(Task).IsAssignableFrom(m.ReturnType); IsMethod = true; } else { Arguments = Array.Empty <ArgumentDescriptor>(); } }
public DirectiveMiddlewareDescriptor( DirectiveMethodMiddleware directiveMethodMiddleware) { if (directiveMethodMiddleware == null) { throw new ArgumentNullException( nameof(directiveMethodMiddleware)); } DirectiveName = directiveMethodMiddleware.DirectiveName; Type = directiveMethodMiddleware.Type; Method = directiveMethodMiddleware.Method; Arguments = FieldResolverDiscoverer .DiscoverArguments(Method); IsAsync = typeof(Task).IsAssignableFrom(Method.ReturnType); HasResult = Method.ReturnType != typeof(void) && Method.ReturnType != typeof(Task); }