IDataServiceStreamProvider2.GetWriteStream Method (Object, ResourceProperty, String, Nullable<Boolean>, DataServiceOperationContext)
Returns the stream that the data service uses to write the binary data received from the client as the specified named stream.
Namespace: System.Data.Services.Providers
Assembly: Microsoft.Data.Services (in Microsoft.Data.Services.dll)
Syntax
'Declaration
Function GetWriteStream ( _
entity As Object, _
streamProperty As ResourceProperty, _
etag As String, _
checkETagForEquality As Nullable(Of Boolean), _
operationContext As DataServiceOperationContext _
) As Stream
'Usage
Dim instance As IDataServiceStreamProvider2
Dim entity As Object
Dim streamProperty As ResourceProperty
Dim etag As String
Dim checkETagForEquality As Nullable(Of Boolean)
Dim operationContext As DataServiceOperationContext
Dim returnValue As Stream
returnValue = instance.GetWriteStream(entity, _
streamProperty, etag, checkETagForEquality, _
operationContext)
Stream GetWriteStream(
Object entity,
ResourceProperty streamProperty,
string etag,
Nullable<bool> checkETagForEquality,
DataServiceOperationContext operationContext
)
Stream^ GetWriteStream(
Object^ entity,
ResourceProperty^ streamProperty,
String^ etag,
Nullable<bool> checkETagForEquality,
DataServiceOperationContext^ operationContext
)
abstract GetWriteStream :
entity:Object *
streamProperty:ResourceProperty *
etag:string *
checkETagForEquality:Nullable<bool> *
operationContext:DataServiceOperationContext -> Stream
function GetWriteStream(
entity : Object,
streamProperty : ResourceProperty,
etag : String,
checkETagForEquality : Nullable<boolean>,
operationContext : DataServiceOperationContext
) : Stream
Parameters
- entity
Type: System.Object
The entity to which the named stream belongs.
- streamProperty
Type: System.Data.Services.Providers.ResourceProperty
A ResourceProperty object that represents the named stream.
- etag
Type: System.String
The eTag value sent as part of the HTTP request that is sent to the data service.
- checkETagForEquality
Type: System.Nullable<Boolean>
A nullable Boolean value that determines what kind of conditional request was issued to the data service, which is true when the eTag was sent in an If-Match header, false when the eTag was sent in an If-None-Match header, and nulla null reference (Nothing in Visual Basic) when the request was not conditional and no eTag was included in the request.
- operationContext
Type: System.Data.Services.DataServiceOperationContext
The DataServiceOperationContext instance used by the data service to process the request.
Return Value
Type: System.IO.Stream
A valid Stream the data service uses to write the contents of a binary data received from the client.
Remarks
The GetWriteStream method should never return a nulla null reference (Nothing in Visual Basic) value.
The 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 nulla null reference (Nothing in Visual Basic). 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.
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 operationContext.