Delen via


TableClient.UpsertEntity<T> Method

Definition

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

public virtual Azure.Response UpsertEntity<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 UpsertEntity : 'T * Azure.Data.Tables.TableUpdateMode * System.Threading.CancellationToken -> Azure.Response (requires 'T :> Azure.Data.Tables.ITableEntity)
override this.UpsertEntity : 'T * Azure.Data.Tables.TableUpdateMode * System.Threading.CancellationToken -> Azure.Response (requires 'T :> Azure.Data.Tables.ITableEntity)
Public Overridable Function UpsertEntity(Of T As ITableEntity) (entity As T, Optional mode As TableUpdateMode = Azure.Data.Tables.TableUpdateMode.Merge, Optional cancellationToken As CancellationToken = Nothing) As 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 update 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