private void TestLambda <TLambda, TParam, TReturn>(CollectionNode source, string parameterName, SingleValueNode body, Expression <Func <TParam, TReturn> > expectedExpression) where TLambda : LambdaNode { EntityRangeVariable currentRangeVariable = null; if (parameterName != null) { currentRangeVariable = new EntityRangeVariable(parameterName, new EdmEntityTypeReference(this.customerEdmType, false), this.entitySet); currentRangeVariable.SetAnnotation(Expression.Parameter(typeof(TParam), parameterName)); } LambdaNode node; if (typeof(TLambda) == typeof(AnyNode)) { node = new AnyNode(new Collection <RangeVariable>(), currentRangeVariable); } else { node = new AllNode(new Collection <RangeVariable>(), currentRangeVariable); } node.Body = body; node.Source = source; var result = this.testSubject.TranslateNode(node); CompareExpressions(expectedExpression.Body, result); }
private static Expression Bind(QueryNode node, IList <ODataQueryNode> queryNodes) { CollectionNode collectionNode = node as CollectionNode; SingleValueNode singleValueNode = node as SingleValueNode; if (collectionNode != null) { // TODO: } else if (singleValueNode != null) { switch (singleValueNode.Kind) { case QueryNodeKind.BinaryOperator: return(BindBinaryOperatorNode(node as BinaryOperatorNode, queryNodes)); case QueryNodeKind.Constant: return(BindConstantNode(node as ConstantNode, queryNodes)); case QueryNodeKind.SingleValuePropertyAccess: return(BindPropertyAccessQueryNode(node as SingleValuePropertyAccessNode, queryNodes)); // case QueryNodeKind.EntityRangeVariableReference: // return BindRangeVariable((node as EntityRangeVariableReferenceNode).RangeVariable); } } return(null); }
private void ValidateCollectionNode(CollectionNode node, ODataValidationSettings settings) { switch (node.Kind) { case QueryNodeKind.CollectionPropertyAccess: CollectionPropertyAccessNode propertyAccessNode = node as CollectionPropertyAccessNode; ValidateCollectionPropertyAccessNode(propertyAccessNode, settings); break; case QueryNodeKind.CollectionComplexNode: CollectionComplexNode collectionComplexNode = node as CollectionComplexNode; ValidateCollectionComplexNode(collectionComplexNode, settings); break; case QueryNodeKind.CollectionNavigationNode: CollectionNavigationNode navigationNode = node as CollectionNavigationNode; ValidateNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty, settings); break; case QueryNodeKind.CollectionResourceCast: ValidateCollectionResourceCastNode(node as CollectionResourceCastNode, settings); break; case QueryNodeKind.CollectionFunctionCall: case QueryNodeKind.CollectionResourceFunctionCall: case QueryNodeKind.CollectionOpenPropertyAccess: // Unused or have unknown uses. default: throw Error.NotSupported(SRResources.QueryNodeValidationNotSupported, node.Kind, typeof(FilterQueryValidator).Name); } }
/// <summary> /// Binds a <see cref="QueryNode"/> to create a LINQ <see cref="Expression"/> that represents the semantics /// of the <see cref="QueryNode"/>. /// </summary> /// <param name="node">The node to bind.</param> /// <returns>The LINQ <see cref="Expression"/> created.</returns> public override Expression Bind(QueryNode node) { if (node == null) { throw Error.ArgumentNull(nameof(node)); } // Recursion guard to avoid stack overflows RuntimeHelpers.EnsureSufficientExecutionStack(); CollectionNode collectionNode = node as CollectionNode; SingleValueNode singleValueNode = node as SingleValueNode; if (collectionNode != null) { return(BindCollectionNode(collectionNode)); } else if (singleValueNode != null) { return(BindSingleValueNode(singleValueNode)); } else { throw Error.NotSupported(SRResources.QueryNodeBindingNotSupported, node.Kind, typeof(FilterBinder).Name); } }
/// <summary> /// Binds a <see cref="CollectionNode"/> to create a LINQ <see cref="Expression"/> that represents the semantics /// of the <see cref="CollectionNode"/>. /// </summary> /// <param name="node">The node to bind.</param> /// <returns>The LINQ <see cref="Expression"/> created.</returns> private Expression BindCollectionNode(CollectionNode node) { switch (node.Kind) { case QueryNodeKind.CollectionNavigationNode: CollectionNavigationNode navigationNode = node as CollectionNavigationNode; return(BindNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty)); case QueryNodeKind.CollectionPropertyAccess: return(BindCollectionPropertyAccessNode(node as CollectionPropertyAccessNode)); case QueryNodeKind.CollectionComplexNode: return(BindCollectionComplexNode(node as CollectionComplexNode)); case QueryNodeKind.CollectionResourceCast: return(BindCollectionResourceCastNode(node as CollectionResourceCastNode)); case QueryNodeKind.CollectionConstant: return(BindCollectionConstantNode(node as CollectionConstantNode)); case QueryNodeKind.CollectionFunctionCall: case QueryNodeKind.CollectionResourceFunctionCall: case QueryNodeKind.CollectionOpenPropertyAccess: default: throw Error.NotSupported(SRResources.QueryNodeBindingNotSupported, node.Kind, typeof(FilterBinder).Name); } }
/// <summary> /// Creates an AnyNode or an AllNode from the given /// </summary> /// <param name="state">State of binding.</param> /// <param name="parent">Parent node to the lambda.</param> /// <param name="lambdaExpression">Bound Lambda expression.</param> /// <param name="newRangeVariable">The new range variable being added by this lambda node.</param> /// <param name="queryTokenKind">Token kind.</param> /// <returns>A new LambdaNode bound to metadata.</returns> internal static LambdaNode CreateLambdaNode( BindingState state, CollectionNode parent, SingleValueNode lambdaExpression, RangeVariable newRangeVariable, QueryTokenKind queryTokenKind) { LambdaNode lambdaNode; if (queryTokenKind == QueryTokenKind.Any) { lambdaNode = new AnyNode(new Collection <RangeVariable>(state.RangeVariables.ToList()), newRangeVariable) { Body = lambdaExpression, Source = parent, }; } else { Debug.Assert(queryTokenKind == QueryTokenKind.All, "LambdaQueryNodes must be Any or All only."); lambdaNode = new AllNode(new Collection <RangeVariable>(state.RangeVariables.ToList()), newRangeVariable) { Body = lambdaExpression, Source = parent, }; } return(lambdaNode); }
/// <summary> /// Binds a LambdaToken to metadata. /// </summary> /// <param name="lambdaToken">Token to bind.</param> /// <param name="state">Object to hold the state of binding.</param> /// <returns>A metadata bound any or all node.</returns> internal LambdaNode BindLambdaToken(LambdaToken lambdaToken, BindingState state) { ExceptionUtils.CheckArgumentNotNull(lambdaToken, "LambdaToken"); ExceptionUtils.CheckArgumentNotNull(state, "state"); // Start by binding the parent token CollectionNode parent = this.BindParentToken(lambdaToken.Parent); RangeVariable rangeVariable = null; // Add the lambda variable to the stack if (lambdaToken.Parameter != null) { rangeVariable = NodeFactory.CreateParameterNode(lambdaToken.Parameter, parent); state.RangeVariables.Push(rangeVariable); } // Bind the expression SingleValueNode expression = this.BindExpressionToken(lambdaToken.Expression); // Create the node LambdaNode lambdaNode = NodeFactory.CreateLambdaNode(state, parent, expression, rangeVariable, lambdaToken.Kind); // Remove the lambda variable as it is now out of scope if (rangeVariable != null) { state.RangeVariables.Pop(); } return(lambdaNode); }
protected string Bind(QueryNode node) { CollectionNode collectionNode = node as CollectionNode; SingleValueNode singleValueNode = node as SingleValueNode; if (collectionNode != null) { switch (node.Kind) { case QueryNodeKind.CollectionNavigationNode: CollectionNavigationNode navigationNode = node as CollectionNavigationNode; return(BindNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty)); case QueryNodeKind.CollectionPropertyAccess: return(BindCollectionPropertyAccessNode(node as CollectionPropertyAccessNode)); } } else if (singleValueNode != null) { switch (node.Kind) { case QueryNodeKind.BinaryOperator: return(BindBinaryOperatorNode(node as BinaryOperatorNode)); case QueryNodeKind.Constant: return(BindConstantNode(node as ConstantNode)); case QueryNodeKind.Convert: return(BindConvertNode(node as ConvertNode)); case QueryNodeKind.EntityRangeVariableReference: return(BindRangeVariable((node as EntityRangeVariableReferenceNode).RangeVariable)); case QueryNodeKind.NonentityRangeVariableReference: return(BindRangeVariable((node as NonentityRangeVariableReferenceNode).RangeVariable)); case QueryNodeKind.SingleValuePropertyAccess: return(BindPropertyAccessQueryNode(node as SingleValuePropertyAccessNode)); case QueryNodeKind.UnaryOperator: return(BindUnaryOperatorNode(node as UnaryOperatorNode)); case QueryNodeKind.SingleValueFunctionCall: return(BindSingleValueFunctionCallNode(node as SingleValueFunctionCallNode)); case QueryNodeKind.SingleNavigationNode: SingleNavigationNode navigationNode = node as SingleNavigationNode; return(BindNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty)); case QueryNodeKind.Any: return(BindAnyNode(node as AnyNode)); case QueryNodeKind.All: return(BindAllNode(node as AllNode)); } } throw new NotSupportedException(String.Format("Nodes of type {0} are not supported", node.Kind)); }
/// <summary> /// Creates a <see cref="TopNode"/>. /// </summary> /// <param name="amount">The number of entities to include in the result.</param> /// <param name="collection">The collection to take items from.</param> public TopNode(QueryNode amount, CollectionNode collection) { ExceptionUtils.CheckArgumentNotNull(amount, "amount"); ExceptionUtils.CheckArgumentNotNull(collection, "collection"); this.amount = amount; this.collection = collection; }
public override void ValidateQueryNode(QueryNode node, ODataValidationSettings settings) { SingleValueNode singleNode = node as SingleValueNode; CollectionNode collectionNode = node as CollectionNode; base.ValidateQueryNode(node, settings); }
public CollectionChild(CollectionNode <T> parent, NodeBase node) { this.node = node; this.parent = parent; connections = new List <KeyValuePair <int, int> >(); weight = 1f; }
/// <summary> /// Creates a <see cref="SkipNode"/>. /// </summary> /// <param name="amount">The number of entities to skip in the result.</param> /// <param name="collection">The type reference to the collection that this node represents.</param> public SkipNode(QueryNode amount, CollectionNode collection) { ExceptionUtils.CheckArgumentNotNull(amount, "amount"); ExceptionUtils.CheckArgumentNotNull(collection, "collection"); this.amount = amount; this.collection = collection; }
public CollectionNodeDynamic(CollectionNode node) { transform = node.transform; Name = node.Name; Offset = node.Offset; Radius = node.Radius; localPositionOnStartup = transform.localPosition; localEulerAnglesOnStartup = transform.localEulerAngles; }
/// <summary> /// Creates a new instance of the <see cref="CollectionNode"/> class and scans it's folder. /// </summary> /// <param name="dir">The folder containing the files of the app/collection</param> public CollectionNode(string dir) { Directory = dir; Name = Path.GetFileName(dir.Trim('\\')); if (System.IO.Directory.Exists(dir + DocumentationDirectory)) { Docs = new Documentation(dir + DocumentationDirectory); } #region Enumerate childs, actions and versions foreach (var File in EnumerateDir(dir)) { var file = File + '\\'; DirectoryInfo diri = new DirectoryInfo(dir); if (diri.Attributes.HasFlag(FileAttributes.Hidden)) { continue; } if (Path.GetFileName(File)[0] == '_') { loadAction(File); continue; } var child = new CollectionNode(file); if (child.Name.StartsWith("v")) { var ver = new Version(); ver.Name = child.Name.Substring(1); ver.Actions.Clear(); ver.Actions.AddRange(child.Actions); foreach (string item in new string[] { "info.md", "info.markdown", "info.html", "info.htm", "info.xhtml", "info.txt" }) { if (System.IO.File.Exists(file + item)) { ver.VersionInfo = ReadDocFile(file + item); ver.VersionInfoPath = file + item; break; } } Versions.Add(ver); continue; } Childs.Add(child); } #endregion }
/// <summary> /// Create a GroupByTransformationNode. /// </summary> /// <param name="groupingProperties">A list of <see cref="GroupByPropertyNode"/>.</param> /// <param name="childTransformations">The child <see cref="TransformationNode"/>.</param> /// <param name="source">The <see cref="CollectionNode"/> representing the source.</param> public GroupByTransformationNode( IList <GroupByPropertyNode> groupingProperties, TransformationNode childTransformations, CollectionNode source) { ExceptionUtils.CheckArgumentNotNull(groupingProperties, "groupingProperties"); this.groupingProperties = groupingProperties; this.childTransformations = childTransformations; this.source = source; }
public void RemoteFromCollection(GameObject obj) { ObjectCollection oc = GetComponent <ObjectCollection>(); CollectionNode node = oc.NodeList.Where((n) => { return(n.transform == obj.transform); }).FirstOrDefault(); if (node != null) { oc.NodeList.Remove(node); oc.UpdateCollection(); } }
/// <summary> /// An das Ende der List wird eine leere Node angehängt /// Diese Node wird dazu benutzt um Nodes, die wieder in die Toolbox angehängt werden richtig darzustellen. /// </summary> public void addEmptyNode() { //hier müssen wir eigentlich noch irgendwie den Typ von den Nodes abfragen. CollectionNode node = new CollectionNode(); node.Name = "emptyNode"; node.transform = null; node.inToolbox = true; node.displayedInToolbox = false; NodeList.Add(node); }
internal void RemoveFromCollection(IGameObject gameObject) { var node = (CCNode)gameObject; Collection.Remove(gameObject); CollectionNode.RemoveChild(node); UpdateCollectionPositions(); node.Scale = Constants.STANDARD_SCALE; // reset the anchor node.AnchorPoint = gameObject.NormalAnchorPoint; MoveCollectionNode(CCPoint.Zero); }
private void ValidateCollectionNode(CollectionNode node, ValidationSettings settings) { switch (node.Kind) { case QueryNodeKind.CollectionPropertyAccess: ValidateQueryNode((node as CollectionPropertyAccessNode).Source, settings); break; case QueryNodeKind.CollectionResourceCast: ValidateQueryNode((node as CollectionResourceCastNode).Source, settings); break; } }
/// <summary> /// Creates a ParameterQueryNode for an explicit parameter. /// </summary> /// <param name="parameter">Name of the parameter.</param> /// <param name="nodeToIterateOver">CollectionNode that the parameter is iterating over.</param> /// <returns>A new RangeVariable.</returns> internal static RangeVariable CreateParameterNode(string parameter, CollectionNode nodeToIterateOver) { IEdmTypeReference elementType = nodeToIterateOver.ItemType; if (elementType != null && elementType.IsEntity()) { var entityCollectionNode = nodeToIterateOver as EntityCollectionNode; Debug.Assert(entityCollectionNode != null, "IF the element type was entity, the node type should be an entity collection"); return(new EntityRangeVariable(parameter, elementType as IEdmEntityTypeReference, entityCollectionNode)); } return(new NonentityRangeVariable(parameter, elementType, null)); }
public void AddToCollection(GameObject obj) { obj.transform.SetParent(transform); obj.transform.localScale = Vector3.one; CollectionNode node = new CollectionNode(); node.transform = obj.transform; ObjectCollection oc = GetComponent <ObjectCollection>(); oc.NodeList.Add(node); oc.UpdateCollection(); }
/// <summary> /// Binds a an end path token into a PropertyAccessToken, OpenPropertyToken, or FunctionCallToken. /// </summary> /// <param name="endPathToken">The property access token to bind.</param> /// <returns>A Query node representing this endpath token, bound to metadata.</returns> internal QueryNode BindEndPath(EndPathToken endPathToken) { ExceptionUtils.CheckArgumentNotNull(endPathToken, "EndPathToken"); ExceptionUtils.CheckArgumentStringNotNullOrEmpty(endPathToken.Identifier, "EndPathToken.Identifier"); // Set the parent (get the parent type, so you can check whether the Identifier inside EndPathToken really is legit offshoot of the parent type) QueryNode parent = this.DetermineParentNode(endPathToken); QueryNode boundFunction; SingleValueNode singleValueParent = parent as SingleValueNode; if (singleValueParent == null) { if (functionCallBinder.TryBindEndPathAsFunctionCall(endPathToken, parent, state, out boundFunction)) { return(boundFunction); } // Collection with any or all expression is already supported and handled separately. // Add support of collection with $count segment. CollectionNode colNode = parent as CollectionNode; if (colNode != null && endPathToken.Identifier.Equals(UriQueryConstants.CountSegment)) { // create a collection count node for collection node property. return(new CountNode(colNode)); } throw new ODataException(ODataErrorStrings.MetadataBinder_PropertyAccessSourceNotSingleValue(endPathToken.Identifier)); } // Now that we have the parent type, can find its corresponding EDM type IEdmStructuredTypeReference structuredParentType = singleValueParent.TypeReference == null ? null : singleValueParent.TypeReference.AsStructuredOrNull(); IEdmProperty property = structuredParentType == null ? null : this.Resolver.ResolveProperty(structuredParentType.StructuredDefinition(), endPathToken.Identifier); if (property != null) { return(GeneratePropertyAccessQueryNode(singleValueParent, property)); } if (functionCallBinder.TryBindEndPathAsFunctionCall(endPathToken, singleValueParent, state, out boundFunction)) { return(boundFunction); } return(GeneratePropertyAccessQueryForOpenType(endPathToken, singleValueParent)); }
private static Node ParseCollection(StreamReader reader, Type type, Dom dom) { List <CollectionNode> nodes = new List <CollectionNode>(); // skip over [ reader.Read(); SkipWhitespace(reader); // read children bool isDictionary = false; while ((char)reader.Peek() != ']') { var node = new CollectionNode(); // read first element node.First = ParseItem(reader, dom); var seperator = (char)reader.Peek(); if (seperator == ':') { // found dictionary key/value separator reader.Read(); // read value node.Second = ParseItem(reader, dom); isDictionary = true; } // skip over , if ((char)reader.Peek() == ',') { reader.Read(); } nodes.Add(node); SkipWhitespace(reader); } // skip over ] reader.Read(); if (isDictionary) { return(CreateDictionary(type, nodes)); } else { return(CreateList(type, nodes)); } }
/// <summary> /// Checks whether a query node is a collection query node representing a collection. /// </summary> /// <param name="query">The <see cref="QueryNode"/> to check.</param> /// <returns>The converted <see cref="CollectionNode"/> or null if <paramref name="query"/> is not a collection node.</returns> internal static CollectionNode AsCollectionNode(this QueryNode query) { Debug.Assert(query != null, "query != null"); CollectionNode collectionNode = query as CollectionNode; if (collectionNode != null && collectionNode.ItemType != null) { return(collectionNode); } return(null); }
/// <summary> /// Override this method if you want to visit each query node. /// </summary> /// <param name="node"></param> /// <param name="settings"></param> public virtual void ValidateQueryNode(QueryNode node, ODataValidationSettings settings) { SingleValueNode singleNode = node as SingleValueNode; CollectionNode collectionNode = node as CollectionNode; if (singleNode != null) { ValidateSingleValueNode(singleNode, settings); } else if (collectionNode != null) { ValidateCollectionNode(collectionNode, settings); } }
internal void AddToCollection(IGameObject gameObject) { var ccNode = (CCNode)gameObject; Collection.Add(gameObject); CollectionNode.AddChild(ccNode); // place the node correctly ccNode.AnchorPoint = NodeAnchor; UpdatePositionsInCollection(); if (MiddleNode == null) { MiddleNode = ccNode; } }
private void ValidateCollectionNode(CollectionNode node, ODataValidationSettings settings) { switch (node.Kind) { case QueryNodeKind.CollectionPropertyAccess: CollectionPropertyAccessNode propertyAccessNode = node as CollectionPropertyAccessNode; ValidateCollectionPropertyAccessNode(propertyAccessNode, settings); break; case QueryNodeKind.CollectionNavigationNode: CollectionNavigationNode navigationNode = node as CollectionNavigationNode; ValidateNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty, settings); break; } }
/// <summary> /// Execute the predicate /// </summary> /// <returns>If the expression is invalid, it will give off a warning and just return the collection itself</returns> public override ObjectNode Invoke() { if (!DoesSatisfySignature()) { Dashboard.RaiseWarningMessage(this, _INVALID_RETURN_TYPE); return(SourceCollection); } return(CollectionNode.Create(new ObservableCollection <ObjectNode>( SourceCollection.Where(e => { Enumerator.SetReferenceTo(e); return Predicate.Eval(); })))); }
/// <summary> /// Retrieves the type reference associated to a segment. /// </summary> /// <param name="segment">The node to retrive the type reference from.</param> /// <returns>The Type reference of the node (item type reference for collections).</returns> internal static IEdmTypeReference GetEdmTypeReference(this QueryNode segment) { SingleValueNode singleNode = segment as SingleValueNode; if (singleNode != null) { return(singleNode.TypeReference); } CollectionNode collectionNode = segment as CollectionNode; if (collectionNode != null) { return(collectionNode.ItemType); } return(null); }
/// <summary> /// Hier werden aus den Nodes, die wir von ROS bekommen Nodes in Unity generiert /// Nachdem alle Nodes erstellt wurden, wird ein Teil der Nodes an die Toolbox weitergegeben um sie darzustellen /// </summary> public void generateNodes(string[] nodesNames) { Debug.Log("generateNodes"); // Wenn wir die Nodes nur Updaten müssen //if (NodeList != null) if (NodeList != null) { Debug.Log("wir gehen in diesen Zweig?"); Debug.Log("Die Nodeliste: " + NodeList); } // wenn wir zum ersten mal ein Nodeupdate bekommen else { Debug.Log("generateNodes, wir erstellen die Nodelist"); NodeList = new List <CollectionNode>(); //Hier werden die Nodes zum ersten mal erzeugt for (int i = 0; i < nodesNames.Length; i++) { //hier müssen wir eigentlich noch irgendwie den Typ von den Nodes abfragen. CollectionNode node = new CollectionNode(); node.Name = nodesNames[i]; node.transform = null; node.inToolbox = true; node.displayedInToolbox = false; NodeList.Add(node); //wir hängen das Object an die Toolbox dran //node.transform.parent = toolboxNodes.transform; } } addEmptyNode(); updateSeitenanzahl(); displayNodes(); Debug.Log("--Länge der Nodeliste: " + NodeList.Count); //toolboxNodes.UpdateCollection(); }
/// <summary> /// Override this method if you want to visit each query node. /// </summary> /// <remarks> /// This method is intended to be called from method overrides in subclasses. This method also supports unit-testing scenarios and is not intended to be called from user code. /// Call the Validate method to validate a <see cref="FilterQueryOption"/> instance. /// </remarks> /// <param name="node"></param> /// <param name="settings"></param> public virtual void ValidateQueryNode(QueryNode node, ODataValidationSettings settings) { // Recursion guard to avoid stack overflows RuntimeHelpers.EnsureSufficientExecutionStack(); SingleValueNode singleNode = node as SingleValueNode; CollectionNode collectionNode = node as CollectionNode; IncrementNodeCount(settings); if (singleNode != null) { ValidateSingleValueNode(singleNode, settings); } else if (collectionNode != null) { ValidateCollectionNode(collectionNode, settings); } }
private void ValidateCollectionNode(CollectionNode node, ODataValidationSettings settings) { switch (node.Kind) { case QueryNodeKind.CollectionPropertyAccess: CollectionPropertyAccessNode propertyAccessNode = node as CollectionPropertyAccessNode; ValidateCollectionPropertyAccessNode(propertyAccessNode, settings); break; case QueryNodeKind.CollectionNavigationNode: CollectionNavigationNode navigationNode = node as CollectionNavigationNode; ValidateNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty, settings); break; case QueryNodeKind.EntityCollectionCast: ValidateEntityCollectionCastNode(node as EntityCollectionCastNode, settings); break; } }
private static Node ParseCollection(StreamReader reader, Type type, Dom dom) { List<CollectionNode> nodes = new List<CollectionNode>(); // skip over [ reader.Read(); SkipWhitespace(reader); // read children bool isDictionary = false; while ((char)reader.Peek() != ']') { var node = new CollectionNode(); // read first element node.First = ParseItem(reader, dom); var seperator = (char)reader.Peek(); if (seperator == ':') { // found dictionary key/value separator reader.Read(); // read value node.Second = ParseItem(reader, dom); isDictionary = true; } // skip over , if ((char)reader.Peek() == ',') reader.Read(); nodes.Add(node); SkipWhitespace(reader); } // skip over ] reader.Read(); if (isDictionary) return CreateDictionary(type, nodes); else return CreateList(type, nodes); }
private void ValidateCollectionNode(CollectionNode node, ODataValidationSettings settings) { switch (node.Kind) { case QueryNodeKind.CollectionPropertyAccess: CollectionPropertyAccessNode propertyAccessNode = node as CollectionPropertyAccessNode; ValidateCollectionPropertyAccessNode(propertyAccessNode, settings); break; case QueryNodeKind.CollectionNavigationNode: CollectionNavigationNode navigationNode = node as CollectionNavigationNode; ValidateNavigationPropertyNode(navigationNode.Source, navigationNode.NavigationProperty, settings); break; case QueryNodeKind.EntityCollectionCast: ValidateEntityCollectionCastNode(node as EntityCollectionCastNode, settings); break; case QueryNodeKind.CollectionFunctionCall: case QueryNodeKind.EntityCollectionFunctionCall: // Unused or have unknown uses. default: throw Error.NotSupported(SRResources.QueryNodeValidationNotSupported, node.Kind, typeof(FilterQueryValidator).Name); } }