/// <summary> /// Created a SingleResourceCastNode with the given source node and the given type to cast to. /// </summary> /// <param name="source"> Source <see cref="SingleValueNode"/> that is being cast.</param> /// <param name="structuredType">Type to cast to.</param> /// <exception cref="System.ArgumentNullException">Throws if the input entityType is null.</exception> public SingleResourceCastNode(SingleResourceNode source, IEdmStructuredType structuredType) { ExceptionUtils.CheckArgumentNotNull(structuredType, "structuredType"); this.source = source; this.navigationSource = source != null ? source.NavigationSource : null; this.structuredTypeReference = structuredType.GetTypeReference(); }
/// <summary> /// Create a CollectionCastNode with the given source node and the given target type. /// </summary> /// <param name="source">Parent <see cref="CollectionNode"/> that is being cast.</param> /// <param name="structuredType">Type to cast to.</param> /// <exception cref="System.ArgumentNullException">Throws if the input source or structuredType are null.</exception> public CollectionResourceCastNode(CollectionResourceNode source, IEdmStructuredType structuredType) { ExceptionUtils.CheckArgumentNotNull(source, "source"); ExceptionUtils.CheckArgumentNotNull(structuredType, "structuredType"); this.source = source; this.edmTypeReference = structuredType.GetTypeReference(); this.navigationSource = source.NavigationSource; // creating a new collection type here because the type in the request is just the item type, there is no user-provided collection type. this.collectionTypeReference = EdmCoreModel.GetCollection(this.edmTypeReference); }