/// <summary> /// For internal use. /// </summary> /// <returns></returns> public override String GetResourcePath(MetadataStore metadataStore) { var dsq = this.DataServiceQuery; var requestUri = dsq.RequestUri.AbsoluteUri; var s2 = requestUri.Replace(__placeholderServiceName, ""); var resourceName = (String.IsNullOrEmpty(ResourceName)) ? metadataStore.GetDefaultResourceName(this.QueryableType) : ResourceName; if (String.IsNullOrEmpty(resourceName)) { throw new Exception("Cannot find a default resource name for CLR type: " + this.QueryableType.FullName); } // if any filter conditions var queryResource = s2.Replace(__placeholderResourceName + "()", resourceName); // if no filter conditions queryResource = queryResource.Replace(__placeholderResourceName, resourceName); // TODO: Hack to avoid DataServiceQuery from inferring the entity key queryResource = queryResource.Replace("$filter=true%20and%20", "$filter="); queryResource = queryResource.Replace("$filter=true", ""); // HACK queryResource = RewriteResourcePath(queryResource); return(queryResource); }
/// <summary> /// For internal use. /// </summary> /// <returns></returns> public override String GetResourcePath(MetadataStore metadataStore) { var resourceName = (String.IsNullOrEmpty(ResourceName)) ? metadataStore.GetDefaultResourceName(this.QueryableType) : ResourceName; if (String.IsNullOrEmpty(resourceName)) { throw new Exception("Cannot find a default resource name for CLR type: " + this.QueryableType.FullName); } if (Configuration.Instance.QueryUriStyle == QueryUriStyle.JSON) { return(GetJsonResourcePath(resourceName)); } else { return(GetOdataResourcePath(resourceName)); } }