Delen via


TableClient.UpsertEntityAsync<T> Method

Definition

Replaces the specified table entity of type T, if it exists. Creates the entity if it does not exist.

public virtual System.Threading.Tasks.Task<Azure.Response> UpsertEntityAsync<T> (T entity, Azure.Data.Tables.TableUpdateMode mode = Azure.Data.Tables.TableUpdateMode.Merge, System.Threading.CancellationToken cancellationToken = default) where T : Azure.Data.Tables.ITableEntity;
abstract member UpsertEntityAsync : 'T * Azure.Data.Tables.TableUpdateMode * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response> (requires 'T :> Azure.Data.Tables.ITableEntity)
override this.UpsertEntityAsync : 'T * Azure.Data.Tables.TableUpdateMode * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response> (requires 'T :> Azure.Data.Tables.ITableEntity)
Public Overridable Function UpsertEntityAsync(Of T As ITableEntity) (entity As T, Optional mode As TableUpdateMode = Azure.Data.Tables.TableUpdateMode.Merge, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)

Type Parameters

T

A custom model type that implements ITableEntity or an instance of TableEntity.

Parameters

entity
T

The entity to upsert.

mode
TableUpdateMode

Determines the behavior of the upsert operation when the entity already exists in the table. See TableUpdateMode for more details.

cancellationToken
CancellationToken

A CancellationToken controlling the request lifetime.

Returns

The Response indicating the result of the operation.

Exceptions

The server returned an error. See Message for details returned from the server.

Applies to