Service Stream Provider. Get Write Stream Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the stream that the data service uses to write the binary data for the media resource received from the client that belongs to the specified entity.
public: System::IO::Stream ^ GetWriteStream(System::Object ^ entity, System::String ^ etag, Nullable<bool> checkETagForEquality, System::Data::Services::DataServiceOperationContext ^ operationContext);
public System.IO.Stream GetWriteStream (object entity, string etag, bool? checkETagForEquality, System.Data.Services.DataServiceOperationContext operationContext);
abstract member GetWriteStream : obj * string * Nullable<bool> * System.Data.Services.DataServiceOperationContext -> System.IO.Stream
Public Function GetWriteStream (entity As Object, etag As String, checkETagForEquality As Nullable(Of Boolean), operationContext As DataServiceOperationContext) As Stream
The entity that is a media link entry with a related media resource.
The eTag value that is sent as part of the HTTP request that is sent to the data service.
A nullable Boolean value that indicates the type of concurrency check requested by the client.
The DataServiceOperationContext instance that is used by the data service to process the request.
A valid Stream the data service uses to write the contents of a binary data received from the client.
The GetWriteStream method is called by the data service runtime when an insert or update operation is being processed for the media resource that is associated with the
The GetWriteStream method should never return a
operationContext is supplied as an argument because an implementer of this interface method will need information from the HTTP request headers to create a write stream. When you implement this method, you must perform concurrency checks as needed. If an If-Match or If-None-Match request header was included in the request, the
etag will not be
null. In this case, this method must perform the appropriate concurrency check. If the concurrency check passes, this method should return the requested stream. If the concurrency checks fail, the method should raise a DataServiceException with the appropriate HTTP response code.
eTag is the value of an If-Match or If-None-Match header.
The following values of
checkETagForEquality are supported:
true- when the eTag represents an If-Match header.
false- when the eTag represents an If-None-Match header.
null- when an If-Match or If-None-Match header is not present in the request.
When you implement this method, you must not set the Content-Type or eTag HTTP response headers because they are set by the data service runtime. You may set the remaining HTTP response headers by using the supplied
When you implement this method, you should only set the properties on
operationContext that are required for a successful response. Changing other properties on
operationContext may corrupt the response from the data service.
The data service runtime closes the stream when all bytes have been successfully written to the stream. If an error occurs while writing to the stream, the data service generates an error response to the client.
When you implement the GetWriteStream method, you should raise the following exceptions as indicated:
|DataServiceException||When a valid stream cannot be returned.|