public ArrayNode(string elementType, IValueNode[] array) { if (array == null) throw new ArgumentNullException(nameof(array)); this.elementType = elementType; this.array = array; }
public PropertyNode(string property, IValueNode value) { if (property == null) throw new ArgumentNullException(nameof(property)); if (value == null) throw new ArgumentNullException(nameof(value)); this.property = property; this.value = value; }
public static IError ProjectionProvider_CouldNotProjectSorting( IValueNode node) => ErrorBuilder.New() .SetMessage(DataResources.ProjectionProvider_CouldNotProjectSorting) .AddLocation(node) .Build();
/// <summary> /// Defines if the specified <paramref name="literal" /> /// can be parsed by this scalar. /// </summary> /// <param name="literal"> /// The literal that shall be checked. /// </param> /// <returns> /// <c>true</c> if the literal can be parsed by this scalar; /// otherwise, <c>false</c>. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="literal" /> is <c>null</c>. /// </exception> public abstract bool IsInstanceOfType(IValueNode literal);
public ArgumentNode WithValue(IValueNode value) { return(new ArgumentNode(Location, Name, value)); }
public ArgumentNode(NameNode name, IValueNode value) : this(null, name, value) { }
public abstract bool IsInstanceOfType(IValueNode valueSyntax);
public override bool IsInstanceOfType(IValueNode valueSyntax) { throw new NotImplementedException(); }
public VariableDefinitionNode WithDefaultValue(IValueNode defaultValue) { return(new VariableDefinitionNode( Location, Variable, Type, defaultValue)); }
public void Create_ArraySomeObjectEqual_Multiple() { // arrange IValueNode value = Utf8GraphQLParser.Syntax.ParseValueLiteral( "{ fooNested: {some: {bar: { eq: \"a\" }}} otherProperty: {eq:null}}"); ExecutorBuilder tester = CreateProviderTester(new FooFilterInput()); // act Func <Foo, bool>?func = tester.Build <Foo>(value); // assert var a = new Foo { FooNested = new[] { new FooNested { Bar = "a" }, new FooNested { Bar = "a" }, new FooNested { Bar = "a" } } }; Assert.True(func(a)); var b = new Foo { FooNested = new[] { new FooNested { Bar = "c" }, new FooNested { Bar = "a" }, new FooNested { Bar = "a" } } }; Assert.True(func(b)); var c = new Foo { FooNested = new[] { new FooNested { Bar = "a" }, new FooNested { Bar = "d" }, new FooNested { Bar = "b" } } }; Assert.True(func(c)); var d = new Foo { FooNested = new[] { new FooNested { Bar = "c" }, new FooNested { Bar = "d" }, new FooNested { Bar = "b" } } }; Assert.False(func(d)); var e = new Foo { FooNested = new[] { null, new FooNested { Bar = null }, new FooNested { Bar = "d" }, new FooNested { Bar = "b" } } }; Assert.False(func(e)); var f = new Foo { OtherProperty = "ShouldBeNull", FooNested = new[] { new FooNested { Bar = "c" }, new FooNested { Bar = "a" }, new FooNested { Bar = "a" } } }; Assert.False(func(f)); }
public void Create_ArrayAllObjectStringEqual_Expression() { // arrange IValueNode value = Utf8GraphQLParser.Syntax.ParseValueLiteral( "{ fooNested: {all: { bar: {eq: \"a\" }}}}"); ExecutorBuilder?tester = CreateProviderTester(new FooFilterInput()); // act Func <Foo, bool>?func = tester.Build <Foo>(value); // assert var a = new Foo { FooNested = new[] { new FooNested { Bar = "a" }, new FooNested { Bar = "a" }, new FooNested { Bar = "a" } } }; Assert.True(func(a)); var b = new Foo { FooNested = new[] { new FooNested { Bar = "c" }, new FooNested { Bar = "a" }, new FooNested { Bar = "a" } } }; Assert.False(func(b)); var c = new Foo { FooNested = new[] { new FooNested { Bar = "a" }, new FooNested { Bar = "d" }, new FooNested { Bar = "b" } } }; Assert.False(func(c)); var d = new Foo { FooNested = new[] { new FooNested { Bar = "c" }, new FooNested { Bar = "d" }, new FooNested { Bar = "b" } } }; Assert.False(func(d)); var e = new Foo { FooNested = new[] { null, new FooNested { Bar = null }, new FooNested { Bar = "d" }, new FooNested { Bar = "b" } } }; Assert.False(func(e)); }
IArgumentDescriptor IArgumentDescriptor.DefaultValue(IValueNode valueNode) { DefaultValue = valueNode ?? new NullValueNode(); NativeDefaultValue = null; return(this); }
public IndexedValueNode(IValueNode <TPrev> prevNode, int index, T value) => (PrevNode, Index, Value) = (prevNode, index, value);
public override object?ParseLiteral(IValueNode valueSyntax, bool withDefaults = true) { throw new NotImplementedException(); }
protected override void OnInitNewState(Context context) { base.OnInitNewState(context); m_value = (IValueNode) m_sequence; m_value.InitNewState(context); }
public CollectionNode(string collectionType, string elementType, IValueNode[] array) : base(elementType, array) { this.collectionType = collectionType; }
public static IValueNode Rewrite( IValueNode value, IType type, IVariableValueCollection variables, ITypeConversion typeConversion) => _current.Value.RewriteValue(value, type, variables, typeConversion);
public void Visit(IValueNode valueNode) { ((FilterDescriptor)CurrentDescriptor).Value = valueNode.Value; }
/// <inheritdoc /> protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { return(ThrowHelper.IsbnType_ParseLiteral_IsInvalid(this)); }
public abstract object?ParseLiteral(IValueNode valueSyntax, bool withDefaults = true);
/// <summary> /// Maps a operation field to a provider specific result. /// This method is called when the <see cref="FilterVisitor{TContext,T}"/> enters a /// field /// </summary> /// <param name="context">The <see cref="IFilterVisitorContext{T}"/> of the visitor</param> /// <param name="field">The field that is currently being visited</param> /// <param name="value">The value node of this field</param> /// <param name="parsedValue">The value of the value node</param> /// <returns>If <c>true</c> is returned the action is used for further processing</returns> public abstract MongoDbFilterDefinition HandleOperation( MongoDbFilterVisitorContext context, IFilterOperationField field, IValueNode value, object?parsedValue);
public ArgumentNode(string name, IValueNode value) : this(null, new NameNode(name), value) { }
IInputFieldDescriptor IInputFieldDescriptor.DefaultValue( IValueNode defaultValue) { DefaultValue(defaultValue); return(this); }
public ArgumentNode(Location?location, NameNode name, IValueNode value) { Location = location; Name = name ?? throw new ArgumentNullException(nameof(name)); Value = value ?? throw new ArgumentNullException(nameof(value)); }
/// <inheritdoc /> protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { throw ThrowHelper.NegativeIntType_ParseLiteral_IsNotNegative(this); }
/// <summary> /// Parses the specified <paramref name="literal" /> /// to the .net representation of this type. /// </summary> /// <param name="literal"> /// The literal that shall be parsed. /// </param> /// <returns></returns> /// <exception cref="ArgumentNullException"> /// <paramref name="literal" /> is <c>null</c>. /// </exception> /// <exception cref="ScalarSerializationException"> /// The specified <paramref name="literal" /> cannot be parsed /// by this scalar. /// </exception> public abstract object ParseLiteral(IValueNode literal);
public abstract Expression HandleOperation( QueryableFilterContext context, IFilterOperationField field, IValueNode value, object parsedValue);
public static GraphQLException FieldVisibility_ValueNotSupported(IValueNode value) => new GraphQLException( ErrorBuilder.New() .SetMessage(ThrowHelper_FieldVisibility_ValueNotSupported_Message) .AddLocation(value) .Build());
internal T DeserializeArgument <T>( Argument argument, IValueNode valueNode) { return((T)DeserializeArgument(argument, valueNode, typeof(T))); }
public new IArgumentDescriptor DefaultValue(IValueNode value) { base.DefaultValue(value); return(this); }
IDirectiveArgumentDescriptor IDirectiveArgumentDescriptor.DefaultValue( IValueNode defaultValue) { DefaultValue(defaultValue); return(this); }
private string CreateValue(IValueNode value) { if (value is ReferenceNode) return CreateReference((ReferenceNode)value); if (value is NumberNode) return CreateNumber((NumberNode)value); if (value is StringNode) return CreateString((StringNode)value); if (value is EnumNode) return CreateEnum((EnumNode)value); if (value is BindingNode) return CreateBinding((BindingNode)value); if (value is CollectionNode) return CreateCollection((CollectionNode)value); if (value is ArrayNode) return CreateArray((ArrayNode)value); else // todo: ...! throw new Exception(); }
protected override void Deserialize(StringReader reader) { base.Deserialize(reader); Value = PExpressionUtility.DeserializeValue(reader); }
public static void SerializeValue(IValueNode value, StringWriter writer) { if (value == null || value.Value == null) writer.WriteLine(); else { writer.WriteLine(value.Type.FullName); writer.WriteLine(Convert.ToString(value.Value)); } }
public override bool IsInstanceOfType(IValueNode literal) { throw new NotImplementedException(); }
protected override void LoadDataFromXml(XmlElement element, Context context) { base.LoadDataFromXml(element, context); ChildValue = (IValueNode) SequenceFactory.Instance.CreateChildrenAsSequence(element, context); }
public override object ParseLiteral(IValueNode literal) { throw new NotImplementedException(); }
protected virtual ISyntaxVisitorAction Enter( IValueNode node, ISyntaxVisitorContext context) => DefaultAction;
public override Expression HandleOperation(QueryableFilterContext context, IFilterOperationField field, IValueNode value, object?parsedValue) { Expression property = context.GetInstance(); if (parsedValue is string fieldValue) { //Compiles to: //property.ToLower().Contains(input.ToLower()); return(Expression.Call(Expression.Call(property, Expressions.ToLower), Expressions.Contains, Expression.Constant(fieldValue.ToLower()))); } throw new InvalidOperationException(); }