DataServiceContext.GetReadStream Method (Object, DataServiceRequestArgs)
Gets binary data stream for the specified entity by using the specified message headers.
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, _
args As DataServiceRequestArgs _
) As DataServiceStreamResponse
'Usage
Dim instance As DataServiceContext
Dim entity As Object
Dim args As DataServiceRequestArgs
Dim returnValue As DataServiceStreamResponse
returnValue = instance.GetReadStream(entity, _
args)
public DataServiceStreamResponse GetReadStream(
Object entity,
DataServiceRequestArgs args
)
public:
DataServiceStreamResponse^ GetReadStream(
Object^ entity,
DataServiceRequestArgs^ args
)
member GetReadStream :
entity:Object *
args:DataServiceRequestArgs -> DataServiceStreamResponse
public function GetReadStream(
entity : Object,
args : DataServiceRequestArgs
) : DataServiceStreamResponse
Parameters
- entity
Type: System.Object
The entity that has the binary stream to retrieve.
- args
Type: System.Data.Services.Client.DataServiceRequestArgs
Instance of DataServiceRequestArgs class that contains settings for the HTTP request message.
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- args 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 binary stream. |
Remarks
The GetReadStream method synchronously requests the binary data stream that belongs to the requested entity.
In the AtomPub protocol, the entity is a Media Link Entry and the stream is the related Media Resource.
No validation is performed on the headers that are set in args. Therefore, do not change an HTTP header in a way that changes the meaning of the request.