/// <summary> /// Creates a CollectionFunctionCallNode to represent a function call that returns a collection /// </summary> /// <param name="name">The name of this function.</param> /// <param name="functionImports">the list of function imports that this node should represent.</param> /// <param name="parameters">the list of already bound parameters to this function</param> /// <param name="returnedCollectionType">the type of the collection returned by this function.</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 <IEdmFunctionImport> functionImports, IEnumerable <QueryNode> parameters, IEdmCollectionTypeReference returnedCollectionType, QueryNode source) { ExceptionUtils.CheckArgumentNotNull(name, "name"); ExceptionUtils.CheckArgumentNotNull(returnedCollectionType, "returnedCollectionType"); this.name = name; this.functionImports = new ReadOnlyCollection <IEdmFunctionImport>(functionImports == null ? new List <IEdmFunctionImport>() : functionImports.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()) { throw new ArgumentException(ODataErrorStrings.Nodes_CollectionFunctionCallNode_ItemTypeMustBePrimitiveOrComplex); } this.source = source; }
/// <summary> /// Creates an EntityCollecitonFunctionCallNode to represent a function call that returns a collection of entities. /// </summary> /// <param name="name">The name of this function.</param> /// <param name="functionImports">the list of function imports that this node represents.</param> /// <param name="parameters">the list of parameters to this function</param> /// <param name="returnedCollectionTypeReference">the type the entity collection returned by this function. The element type must be an entity type.</param> /// <param name="entitySet">the set containing entities returned by this function</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 function imports is null</exception> public EntityCollectionFunctionCallNode(string name, IEnumerable <IEdmFunctionImport> functionImports, IEnumerable <QueryNode> parameters, IEdmCollectionTypeReference returnedCollectionTypeReference, IEdmEntitySet entitySet, QueryNode source) { ExceptionUtils.CheckArgumentNotNull(name, "name"); ExceptionUtils.CheckArgumentNotNull(returnedCollectionTypeReference, "returnedCollectionTypeReference"); this.name = name; this.functionImports = new ReadOnlyCollection <IEdmFunctionImport>(functionImports == null ? new List <IEdmFunctionImport>() : functionImports.ToList()); this.parameters = new ReadOnlyCollection <QueryNode>(parameters == null ? new List <QueryNode>() : parameters.ToList()); this.returnedCollectionTypeReference = returnedCollectionTypeReference; this.entitySet = entitySet; this.entityTypeReference = returnedCollectionTypeReference.ElementType().AsEntityOrNull(); if (this.entityTypeReference == null) { throw new ArgumentException(ODataErrorStrings.Nodes_EntityCollectionFunctionCallNode_ItemTypeMustBeAnEntity); } this.source = source; }