private QueryNode BindNonRootSegment(SegmentQueryToken segmentToken) { Debug.Assert(segmentToken != null, "segmentToken != null"); Debug.Assert(segmentToken.Parent != null, "Only root segments should be allowed here."); Debug.Assert(!string.IsNullOrEmpty(segmentToken.Name), "!string.IsNullOrEmpty(segmentToken.Name)"); //// This is a metadata-only version of the RequestUriProcessor.CreateFirstSegment. if (segmentToken.Name == UriQueryConstants.MetadataSegment || segmentToken.Name == UriQueryConstants.BatchSegment) { // TODO: $metadata segment parsing - no key values are allowed. // TODO: $batch segment parsing - no key values are allowed. throw new NotImplementedException(); } // TODO: WCF DS checks for $count here first and fails. But not for the other $ segments. // which means other $segments get to SO resolution. On the other hand the WCF DS would eventually fail if an SO started with $. // Look for a service operation ServiceOperationWrapper serviceOperation = this.metadataProvider.TryResolveServiceOperation(segmentToken.Name); if (serviceOperation != null) { return this.BindServiceOperation(segmentToken, serviceOperation); } // TODO: Content-ID reference resolution. Do we actually do anything here or do we perform this through extending the metadata binder? // Look for an entity set. ResourceSetWrapper resourceSet = this.metadataProvider.TryResolveResourceSet(segmentToken.Name); if (resourceSet == null) { throw new ODataException(Strings.MetadataBinder_RootSegmentResourceNotFound(segmentToken.Name)); } ResourceSetQueryNode resourceSetQueryNode = new ResourceSetQueryNode() { ResourceSet = resourceSet.ResourceSet }; if (segmentToken.NamedValues != null) { return this.BindKeyValues(resourceSetQueryNode, segmentToken.NamedValues); } else { return resourceSetQueryNode; } }
/// <summary> /// Translates a resource set node. /// </summary> /// <param name="resourceSetNode">The resource set query node to translate.</param> /// <returns>Expression which evaluates to IQueryable<T> where T is the InstanceType of the ResourceType of the resource set.</returns> protected abstract Expression TranslateResourceSet(ResourceSetQueryNode resourceSetNode);