DataServiceContext.GetReadStream Method (Object, String)
Gets the binary data stream that belongs to the specified entity, by using the specified Content-Type message header.
Not supported by the WCF Data Services 5.0 client for Silverlight.
Namespace: System.Data.Services.Client
Assembly: Microsoft.Data.Services.Client (in Microsoft.Data.Services.Client.dll)
Syntax
'Declaration
Public Function GetReadStream ( _
entity As Object, _
acceptContentType As String _
) As DataServiceStreamResponse
'Usage
Dim instance As DataServiceContext
Dim entity As Object
Dim acceptContentType As String
Dim returnValue As DataServiceStreamResponse
returnValue = instance.GetReadStream(entity, _
acceptContentType)
public DataServiceStreamResponse GetReadStream(
Object entity,
string acceptContentType
)
public:
DataServiceStreamResponse^ GetReadStream(
Object^ entity,
String^ acceptContentType
)
member GetReadStream :
entity:Object *
acceptContentType:string -> DataServiceStreamResponse
public function GetReadStream(
entity : Object,
acceptContentType : String
) : DataServiceStreamResponse
Parameters
- entity
Type: System.Object
The entity that has the binary data stream to retrieve.
- acceptContentType
Type: System.String
The Content-Type of the binary data stream requested from the data service, specified in the Accept header.
Return Value
Type: System.Data.Services.Client.DataServiceStreamResponse
An instance of DataServiceStreamResponse that represents the response.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | entity is nulla null reference (Nothing in Visual Basic). -or- acceptContentType is nulla null reference (Nothing in Visual Basic). |
ArgumentException | The entity is not tracked by this DataServiceContext. -or- The entity is in the Added state. -or- The entity is not a Media Link Entry and does not have a related stream. |
Remarks
The acceptContentType parameter should be a valid Content-Type value for the Accept HTTP header.
The GetReadStream method synchronously requests the related binary data stream for the entity.
In the AtomPub protocol, the entity is a Media Link Entry and the binary stream is the associated Media Resource.
No validation is performed on the headers that are set in acceptContentType. Therefore, do not change this HTTP header in a way that changes the meaning of the request.