/// <summary> /// Create a SingleValueFunctionCallNode /// </summary> /// <param name="name">The name of the function to call</param> /// <param name="functions">the list of functions that this node should represent.</param> /// <param name="parameters">the list of arguments to this function</param> /// <param name="returnedTypeReference">the type of the value returned by this function.</param> /// <param name="source">The semantically bound parent of this function.</param> /// <exception cref="System.ArgumentNullException">Throws if the input operationImports is null.</exception> public SingleValueFunctionCallNode(string name, IEnumerable <IEdmFunction> functions, IEnumerable <QueryNode> parameters, IEdmTypeReference returnedTypeReference, QueryNode source) { ExceptionUtils.CheckArgumentNotNull(name, "name"); this.name = name; this.functions = new ReadOnlyCollection <IEdmFunction>(functions != null ? functions.ToList() : new List <IEdmFunction>()); this.parameters = parameters ?? Enumerable.Empty <QueryNode>(); if (returnedTypeReference != null) { if (returnedTypeReference.IsCollection() || !(returnedTypeReference.IsComplex() || returnedTypeReference.IsPrimitive() || returnedTypeReference.IsEnum())) { throw new ArgumentException(ODataErrorStrings.Nodes_SingleValueFunctionCallNode_ItemTypeMustBePrimitiveOrComplexOrEnum); } } this.returnedTypeReference = returnedTypeReference; this.source = source; }
/// <summary> /// Creates an EntityCollectionFunctionCallNode to represent a operation call that returns a collection of entities. /// </summary> /// <param name="name">The name of this operation.</param> /// <param name="functions">the list of functions that this node should represent.</param> /// <param name="parameters">the list of parameters to this operation</param> /// <param name="returnedCollectionTypeReference">the type the entity collection returned by this operation. The element type must be an entity type.</param> /// <param name="navigationSource">the set containing entities returned by this operation</param> /// <param name="source">the semantically bound parent of this EntityCollectionFunctionCallNode.</param> /// <exception cref="System.ArgumentNullException">Throws if the provided name is null.</exception> /// <exception cref="System.ArgumentNullException">Throws if the provided collection type reference is null.</exception> /// <exception cref="System.ArgumentException">Throws if the element type of the provided collection type reference is not an entity type.</exception> /// <exception cref="System.ArgumentNullException">Throws if the input operation imports is null</exception> public EntityCollectionFunctionCallNode(string name, IEnumerable <IEdmFunction> functions, IEnumerable <QueryNode> parameters, IEdmCollectionTypeReference returnedCollectionTypeReference, IEdmEntitySetBase navigationSource, QueryNode source) { ExceptionUtils.CheckArgumentNotNull(name, "name"); ExceptionUtils.CheckArgumentNotNull(returnedCollectionTypeReference, "returnedCollectionTypeReference"); this.name = name; this.functions = new ReadOnlyCollection <IEdmFunction>(functions == null ? new List <IEdmFunction>() : functions.ToList()); this.parameters = new ReadOnlyCollection <QueryNode>(parameters == null ? new List <QueryNode>() : parameters.ToList()); this.returnedCollectionTypeReference = returnedCollectionTypeReference; this.navigationSource = navigationSource; this.entityTypeReference = returnedCollectionTypeReference.ElementType().AsEntityOrNull(); if (this.entityTypeReference == null) { throw new ArgumentException(ODataErrorStrings.Nodes_EntityCollectionFunctionCallNode_ItemTypeMustBeAnEntity); } this.source = source; }
/// <summary> /// Create a SingleEntityFunctionCallNode /// </summary> /// <param name="name">The name of the operation import to call</param> /// <param name="functions">the list of functions this node represents.</param> /// <param name="parameters">List of arguments provided to the function. Can be null.</param> /// <param name="returnedEntityTypeReference">The return type of this operation import.</param> /// <param name="navigationSource">The entity set or singleton containing the single entity that this operation import returns.</param> /// <param name="source">The semantically bound parent of this operation import.</param> /// <exception cref="System.ArgumentNullException">Throws if the input name, returnedEntityTypeReference, or navigationSource is null.</exception> public SingleEntityFunctionCallNode(string name, IEnumerable <IEdmFunction> functions, IEnumerable <QueryNode> parameters, IEdmEntityTypeReference returnedEntityTypeReference, IEdmNavigationSource navigationSource, QueryNode source) { ExceptionUtils.CheckArgumentNotNull(name, "name"); ExceptionUtils.CheckArgumentNotNull(returnedEntityTypeReference, "returnedEntityTypeReference"); this.name = name; this.functions = new ReadOnlyCollection <IEdmFunction>(functions != null ? functions.ToList() : new List <IEdmFunction>()); this.parameters = new ReadOnlyCollection <QueryNode>(parameters == null ? new List <QueryNode>() : parameters.ToList()); this.returnedEntityTypeReference = returnedEntityTypeReference; this.navigationSource = navigationSource; this.source = source; }
/// <summary> /// Creates a NamedFunctionParameterNode to represent a semantically parsed parameter to a function. /// </summary> /// <param name="name">the name of this function</param> /// <param name="value">the already semantically parsed value of this parameter.</param> public NamedFunctionParameterNode(string name, QueryNode value) { this.name = name; this.value = value; }
/// <summary> /// Creates a CollectionFunctionCallNode to represent a operation call that returns a collection /// </summary> /// <param name="name">The name of this operation.</param> /// <param name="functions">the list of functions that this node should represent.</param> /// <param name="parameters">the list of already bound parameters to this operation</param> /// <param name="returnedCollectionType">the type of the collection returned by this operation.</param> /// <param name="source">The parent of this CollectionFunctionCallNode.</param> /// <exception cref="System.ArgumentNullException">Throws if the provided name is null.</exception> /// <exception cref="System.ArgumentNullException">Throws if the provided collection type reference is null.</exception> /// <exception cref="System.ArgumentException">Throws if the element type of the provided collection type reference is not a primitive or complex type.</exception> public CollectionFunctionCallNode(string name, IEnumerable <IEdmFunction> functions, IEnumerable <QueryNode> parameters, IEdmCollectionTypeReference returnedCollectionType, QueryNode source) { ExceptionUtils.CheckArgumentNotNull(name, "name"); ExceptionUtils.CheckArgumentNotNull(returnedCollectionType, "returnedCollectionType"); this.name = name; this.functions = new ReadOnlyCollection <IEdmFunction>(functions == null ? new List <IEdmFunction>() : functions.ToList()); this.parameters = new ReadOnlyCollection <QueryNode>(parameters == null ? new List <QueryNode>() : parameters.ToList()); this.returnedCollectionType = returnedCollectionType; this.itemType = returnedCollectionType.ElementType(); if (!this.itemType.IsPrimitive() && !this.itemType.IsComplex() && !this.itemType.IsEnum()) { throw new ArgumentException(ODataErrorStrings.Nodes_CollectionFunctionCallNode_ItemTypeMustBePrimitiveOrComplexOrEnum); } this.source = source; }