public virtual ITypeReference GetReturnType( MemberInfo member, TypeContext context) { if (member == null) { throw new ArgumentNullException(nameof(member)); } Type returnType = GetReturnType(member); if (member.IsDefined(typeof(GraphQLTypeAttribute))) { GraphQLTypeAttribute attribute = member.GetCustomAttribute <GraphQLTypeAttribute>(); returnType = attribute.Type; } if (member.IsDefined(typeof(GraphQLNonNullTypeAttribute))) { GraphQLNonNullTypeAttribute attribute = member.GetCustomAttribute <GraphQLNonNullTypeAttribute>(); return(new ClrTypeReference( returnType, context, attribute.IsNullable, attribute.IsElementNullable) .Compile()); } return(new ClrTypeReference(returnType, context)); }
public ITypeReference GetArgumentType(ParameterInfo parameter) { if (parameter == null) { throw new ArgumentNullException(nameof(parameter)); } Type argumentType = GetArgumentTypeInternal(parameter); if (parameter.IsDefined(typeof(GraphQLTypeAttribute))) { GraphQLTypeAttribute attribute = parameter.GetCustomAttribute <GraphQLTypeAttribute>(); argumentType = attribute.Type; } if (parameter.IsDefined(typeof(GraphQLNonNullTypeAttribute))) { GraphQLNonNullTypeAttribute attribute = parameter.GetCustomAttribute <GraphQLNonNullTypeAttribute>(); return(new ClrTypeReference( argumentType, TypeContext.Input, attribute.IsNullable, attribute.IsElementNullable) .Compile()); } return(new ClrTypeReference(argumentType, TypeContext.Input)); }