Esempio n. 1
0
        private object ValueFromScalar(ScalarGraphType scalar, object input)
        {
            if (input is IValue)
            {
                return(scalar.ParseLiteral((IValue)input));
            }

            return(scalar.ParseValue(input));
        }
Esempio n. 2
0
 public ReplaceScalarVisitor(ScalarGraphType replacement)
 {
     _replacement = replacement ?? throw new ArgumentNullException(nameof(replacement));
 }
Esempio n. 3
0
 /// <summary>
 /// Replaces one scalar in the schema to another with the same name.
 /// </summary>
 /// <typeparam name="TSchema">Type of the schema.</typeparam>
 /// <param name="schema">The schema for which to replace the scalar.</param>
 /// <param name="scalar">New scalar. The replacement occurs by its name.</param>
 /// <returns>Reference to the provided <paramref name="schema"/>.</returns>
 public static TSchema ReplaceScalar <TSchema>(this TSchema schema, ScalarGraphType scalar)
     where TSchema : ISchema
 {
     new ReplaceScalarVisitor(scalar).Run(schema);
     return(schema);
 }