/// <summary> /// This method is invoked by the data services framework to obtain the URI clients should use when making retrieve (ie. GET) /// requests to the stream(ie. Media Resource). This metadata is needed when constructing the payload for the Media Link Entry /// associated with the stream (aka Media Resource). /// /// If IDataServiceStreamProvider.GetReadStreamUri returns a valid Uri, we return that as the Uri to the Media Resource. /// Otherwise we take the given Media Link Entry uri, and construct the default Media Resource Uri. /// </summary> /// <param name="entity">The entity associated with the stream for which a “read stream” is to be obtained</param> /// <param name="operationContext">A reference to the context for the current operation.</param> /// <param name="mediaLinkEntryUri">Uri to the Media Link Entry.</param> /// <returns>The URI clients should use when making retrieve (ie. GET) requests to the stream(ie. Media Resource).</returns> internal Uri GetReadStreamUri(object entity, DataServiceOperationContext operationContext, string mediaLinkEntryUri) { Debug.Assert(entity != null, "entity != null"); Debug.Assert(operationContext != null, "operationContext != null"); Uri readStreamUri = InvokeApiCallAndValidateHeaders("IDataServiceStreamProvider.GetReadStreamUri", () => this.StreamProvider.GetReadStreamUri(entity, operationContext), operationContext); if (readStreamUri != null) { if (!readStreamUri.IsAbsoluteUri) { throw new InvalidOperationException(Strings.DataServiceStreamProviderWrapper_GetReadStreamUriMustReturnAbsoluteUriOrNull); } else { return(readStreamUri); } } else { return(new Uri(DataServiceStreamProviderWrapper.GetStreamEditMediaUri(mediaLinkEntryUri), UriKind.RelativeOrAbsolute)); } }