Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IDataServiceStreamProvider.GetReadStream Method

Returns a stream that contains the media resource data for the specified entity, which is a media link entry.

Namespace:  System.Data.Services.Providers
Assembly:  Microsoft.Data.Services (in Microsoft.Data.Services.dll)

Stream GetReadStream(
	Object entity,
	string etag,
	Nullable<bool> checkETagForEquality,
	DataServiceOperationContext operationContext


Type: System.Object
The entity that is a media link entry with a related media resource.
Type: System.String
The eTag value sent as part of the HTTP request that is sent to the data service.
Type: System.Nullable<Boolean>
A nullable Boolean value that determines what kind of conditional request was issued to the data service, which is true when the eTag was sent in an If-Match header, false when the eTag was sent in an If-None-Match header, and null when the request was not conditional and no eTag was included in the request.
Type: System.Data.Services.DataServiceOperationContext
The DataServiceOperationContext instance used by the data service to process the request.

Return Value

Type: System.IO.Stream
The data Stream that contains the binary property data of the entity.

This method is invoked by the data services framework to retrieve the default stream associated with the entity instance specified by the entity parameter. Notes to Interface Implementers The operationContext argument is passed as it is likely that an implementer of this interface method will need information from the HTTP request headers in order to construct a stream. Likely header values required are: 'Accept' 'Accept-Charset' 'Accept-Encoding' An implementer of this method MUST perform concurrency checks as needed in their implementation of this method. If an If-Match or If-None-Match request header was included in the request, then the etag parameter will be non null, which indicates this method MUST perform the appropriate concurrency check. If the concurrency check passes, this method should return the requested stream. If the concurrency checks fails, the method should throw a DataServiceException with the appropriate HTTP response code as defined in HTTP RFC 2616 section 14.24 and section 14.26. If the etag was sent as the value of an If-Match request header, the value of the ‘checkETagForEquality’ header will be set to true If the etag was sent as the value of an If-None-Match request header, the value of the ‘checkETagForEquality’ header will be set to false It is the responsibility of the implementer of this method to honor the values of the appropriate request headers when generating the returned response stream. An implementer of this method MUST NOT set the following HTTP response headers on the operationContext parameter as they are set by the data service runtime: Content-Type ETag An implementer of this method may set HTTP response headers (other than those forbidden above) on the operationContext parameter. An implementer of this method should only set the properties on the operationContext parameter which it requires to be set for a successful response. Altering other properties on the operationContext parameter may corrupt the response from the data service. Stream Ownership The data service framework will dispose the stream once all bytes have been successfully read. If an error occurs while reading the stream, then the data services framework will generate an in-stream error which is sent back to the client. See the error contract specification for a description of the format of in-stream errors

© 2015 Microsoft