DataServiceContext.SetSaveStream Method (Object, Stream, Boolean, DataServiceRequestArgs)
Sets a new data stream as the binary property of an entity, with the specified settings in the request message.
Assembly: System.Data.Services.Client (in System.Data.Services.Client.dll)
public void SetSaveStream( Object entity, Stream stream, bool closeStream, DataServiceRequestArgs args )
- Type: System.Object
The entity that has a binary property to which to assign the data stream.
- Type: System.Boolean
- Type: System.Data.Services.Client.DataServiceRequestArgs
An instance of the DataServiceRequestArgs class that contains settings for the HTTP request message.
This topic describes new functionality in ADO.NET Data Services that is available as an update to the .NET Framework version 3.5 Service Pack 1. You can download and install the update from the Microsoft Download Center.
The SetSaveStream method sets the binary stream that is the Media Resource that is associated with the entity, which is called a Media Link Entry.
Calling the SetSaveStream method marks the entity as a Media Link Entry. The entity state is also set to Modified so that the stream will be sent to the data service the next time that the SaveChanges method is called.
When closeStream is true, the SaveChanges method closes the stream before it returns. The stream is closed even when an error occurs and the stream is not read.
When the entity has the MediaEntryAttribute applied, the Media Resource cannot be a data stream. Remove this attribute before you try to set the data stream for the entity.
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.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.