Exemplo n.º 1
0
        public static string GetGraphQLName(this MethodInfo method)
        {
            string name = method.IsDefined(
                typeof(GraphQLNameAttribute), false)
                                ? method.GetCustomAttribute <GraphQLNameAttribute>().Name
                                : NormalizeMethodName(method);

            return(NameUtils.RemoveInvalidCharacters(name));
        }
Exemplo n.º 2
0
        public static string GetGraphQLName(this ParameterInfo parameter)
        {
            string name = parameter.IsDefined(
                typeof(GraphQLNameAttribute), false)
                                ? parameter.GetCustomAttribute <GraphQLNameAttribute>().Name
                                : NormalizeName(parameter.Name);

            return(NameUtils.RemoveInvalidCharacters(name));
        }
Exemplo n.º 3
0
        public static string GetGraphQLName(this Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            TypeInfo typeInfo = type.GetTypeInfo();
            string   name     = typeInfo.IsDefined(
                typeof(GraphQLNameAttribute), false)
                                ? typeInfo.GetCustomAttribute <GraphQLNameAttribute>().Name
                                : GetFromType(typeInfo);

            return(NameUtils.RemoveInvalidCharacters(name));
        }