DataServiceContext.BeginGetReadStream Method (Object, DataServiceRequestArgs, AsyncCallback, Object)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Asynchronously gets binary property data for the specified entity as a data stream along with the specified message headers.

Namespace:   System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

public IAsyncResult BeginGetReadStream(
	object entity,
	DataServiceRequestArgs args,
	AsyncCallback callback,
	object state


Type: System.Object

The entity that has the binary property to retrieve.

Type: System.Data.Services.Client.DataServiceRequestArgs

Instance of the DataServiceRequestArgs class that contains settings for the HTTP request message.

Type: System.AsyncCallback

Delegate to invoke when results are available for client consumption.

Type: System.Object

User-defined state object passed to the callback.

Return Value

Type: System.IAsyncResult

An IAsyncResult object that is used to track the status of the asynchronous operation.

Exception Condition

Any of the parameters supplied to the method is null.


The entity is not tracked by this DataServiceContext.


The entity is in the Added state.


The entity is not a Media Link Entry and does not have a binary property.

The GetReadStream method asynchronously requests a data stream that contains the binary property of the requested entity.

In the AtomPub protocol, the entity is a Media Link Entry and the binary property is the associated 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.

.NET Framework
Available since 3.5
Available since 4.0
Return to top