Share via


DataServiceContext.SetSaveStream Method

Definition

Overloads

SetSaveStream(Object, Stream, Boolean, DataServiceRequestArgs)

Sets a binary data stream for the specified entity, with the specified headers in the request message.

SetSaveStream(Object, Stream, Boolean, String, String)

Sets a binary data stream that belongs to the specified entity, with the specified Content-Type and Slug headers in the request message.

SetSaveStream(Object, String, Stream, Boolean, DataServiceRequestArgs)

Sets a named binary data stream that belongs to the specified entity, with the specified headers in the request message.

SetSaveStream(Object, String, Stream, Boolean, String)

Sets a binary data stream for the specified entity.

SetSaveStream(Object, Stream, Boolean, DataServiceRequestArgs)

Sets a binary data stream for the specified entity, with the specified headers in the request message.

public virtual void SetSaveStream (object entity, System.IO.Stream stream, bool closeStream, Microsoft.OData.Client.DataServiceRequestArgs args);
abstract member SetSaveStream : obj * System.IO.Stream * bool * Microsoft.OData.Client.DataServiceRequestArgs -> unit
override this.SetSaveStream : obj * System.IO.Stream * bool * Microsoft.OData.Client.DataServiceRequestArgs -> unit
Public Overridable Sub SetSaveStream (entity As Object, stream As Stream, closeStream As Boolean, args As DataServiceRequestArgs)

Parameters

entity
Object

The entity to which the binary stream belongs.

stream
Stream

The Stream from which to read the binary data.

closeStream
Boolean

A Boolean value that determines whether the data stream is closed when the SaveChanges() method is completed.

args
DataServiceRequestArgs

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

Exceptions

Any of the parameters supplied to the method are null.

The entity is not being tracked by this DataServiceContext instance. -or-The entity has the MediaEntryAttribute applied.

Remarks

Calling this method marks the entity as media link resource (MLE). It also marks the entity as modified so that it will participate in the next call to SaveChanges.

Applies to

SetSaveStream(Object, Stream, Boolean, String, String)

Sets a binary data stream that belongs to the specified entity, with the specified Content-Type and Slug headers in the request message.

public virtual void SetSaveStream (object entity, System.IO.Stream stream, bool closeStream, string contentType, string slug);
abstract member SetSaveStream : obj * System.IO.Stream * bool * string * string -> unit
override this.SetSaveStream : obj * System.IO.Stream * bool * string * string -> unit
Public Overridable Sub SetSaveStream (entity As Object, stream As Stream, closeStream As Boolean, contentType As String, slug As String)

Parameters

entity
Object

The entity to which the data stream belongs.

stream
Stream

The Stream from which to read the binary data.

closeStream
Boolean

A Boolean value that determines whether the data stream is closed when the SaveChanges() method is completed.

contentType
String

The Content-Type header value for the request message.

slug
String

The Slug header value for the request message.

Exceptions

Any of the parameters supplied to the method are null.

The entity is not being tracked by this DataServiceContext instance. -or-The entity has the MediaEntryAttribute applied.

Remarks

Calling this method marks the entity as media link resource (MLE). It also marks the entity as modified so that it will participate in the next call to SaveChanges.

Applies to

SetSaveStream(Object, String, Stream, Boolean, DataServiceRequestArgs)

Sets a named binary data stream that belongs to the specified entity, with the specified headers in the request message.

public virtual void SetSaveStream (object entity, string name, System.IO.Stream stream, bool closeStream, Microsoft.OData.Client.DataServiceRequestArgs args);
abstract member SetSaveStream : obj * string * System.IO.Stream * bool * Microsoft.OData.Client.DataServiceRequestArgs -> unit
override this.SetSaveStream : obj * string * System.IO.Stream * bool * Microsoft.OData.Client.DataServiceRequestArgs -> unit
Public Overridable Sub SetSaveStream (entity As Object, name As String, stream As Stream, closeStream As Boolean, args As DataServiceRequestArgs)

Parameters

entity
Object

The entity to which the binary stream belongs.

name
String

The name of the binary stream to save.

stream
Stream

The Stream from which to read the binary data.

closeStream
Boolean

A Boolean value that determines whether the data stream is closed when the SaveChanges() method is completed.

args
DataServiceRequestArgs

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

Exceptions

The entity is not being tracked. The entity has the MediaEntry attribute marking it to use the older way of handling MRs.

Any of the arguments is null.

Remarks

Calling this method marks the entity as media link resource (MLE). It also marks the entity as modified so that it will participate in the next call to SaveChanges.

Applies to

SetSaveStream(Object, String, Stream, Boolean, String)

Sets a binary data stream for the specified entity.

public virtual void SetSaveStream (object entity, string name, System.IO.Stream stream, bool closeStream, string contentType);
abstract member SetSaveStream : obj * string * System.IO.Stream * bool * string -> unit
override this.SetSaveStream : obj * string * System.IO.Stream * bool * string -> unit
Public Overridable Sub SetSaveStream (entity As Object, name As String, stream As Stream, closeStream As Boolean, contentType As String)

Parameters

entity
Object

The entity to which the binary stream belongs.

name
String

The name of the binary stream to save.

stream
Stream

The Stream from which to read the binary data.

closeStream
Boolean

A Boolean value that determines whether the data stream is closed when the SaveChanges() method is completed.

contentType
String

The Content-Type header value for the request message.

Exceptions

The entity is not being tracked or name is an empty string.

Any of the arguments is null.

Applies to