コード例 #1
0
 public T GetParameter <T>(string parameter) => parameters.ContainsKey(parameter)
     ? (T)parameters[parameter].BindTo(typeof(T)) !
     : throw new ArgumentException("Missing argument on GraphQL query").AddGraphQlError(WellKnownErrorCodes.MissingArgument, EmptyArrayHelper.Empty <QueryLocation>(), new { argument = parameter });
コード例 #2
0
 public static System.Collections.Generic.IReadOnlyList <QueryLocation> ToQueryLocations(this Ast.Nodes.LocationRange location)
 {
     return(location.Start.Line == 0 && location.Start.Column == 0
         ? EmptyArrayHelper.Empty <QueryLocation>()
         : new[] { new QueryLocation(location.Start.Line, location.Start.Column) });
 }
コード例 #3
0
 internal static IGraphQlScalarResult <TReturnType> CreateJoin(FieldContext fieldContext, LambdaExpression newFunc, IGraphQlJoin join)
 {
     return(new GraphQlExpressionScalarResult <TReturnType>(fieldContext, new[] { newFunc }, EmptyArrayHelper.Empty <ExpressionVisitor>(), ImmutableHashSet.Create(join)));
 }
コード例 #4
0
 internal static IGraphQlScalarResult <TReturnType> Simple(FieldContext fieldContext, LambdaExpression newFunc)
 {
     return(new GraphQlExpressionScalarResult <TReturnType>(fieldContext, new[] { newFunc }, EmptyArrayHelper.Empty <ExpressionVisitor>(), ImmutableHashSet <IGraphQlJoin> .Empty));
 }
コード例 #5
0
 internal static IGraphQlScalarResult <TReturnType> Constant(TReturnType result, FieldContext fieldContext)
 {
     return(new GraphQlExpressionScalarResult <TReturnType>(fieldContext, new[] { (Expression <Func <object?, TReturnType> >)(_ => result) }, EmptyArrayHelper.Empty <ExpressionVisitor>(), ImmutableHashSet <IGraphQlJoin> .Empty));
 }
コード例 #6
0
 public GraphQlResultFactory(FieldContext fieldContext)
     : base(fieldContext, new[] { identity }, EmptyArrayHelper.Empty <ExpressionVisitor>(), EmptyArrayHelper.Empty <IGraphQlJoin>())
 {
 }