Skip to content

UpsertAsync Method ​

Definition ​

  • Namespace: JASE.Database
  • Assembly: JASE.Database.dll

Overloads ​

NameDescription
Task<bool> UpsertAsync(T item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Inserts or updates a record depending on whether it already exists.
Task<bool> UpsertAsync(Type entityType, object item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)Inserts or updates a record using a runtime entity type.

Task<bool> UpsertAsync(Type entityType, object item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null) ​

csharp
Task<bool> UpsertAsync(Type entityType, object item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)

Inserts or updates a record using a runtime entity type.

Task<bool> UpsertAsync(T item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null) ​

csharp
Task<bool> UpsertAsync(T item, int commandTimeout = null, CancellationToken cancellationToken = null, UpsertConflictAction conflictAction = null)

Inserts or updates a record depending on whether it already exists.

Type parameters ​

NameDescription
TThe entity (row) type.

Parameters ​

NameDescription
cancellationTokenCancellation token.
commandTimeoutCommand timeout in seconds. Use -1 for provider default.
conflictActionBehavior when the primary key already exists.
itemItem to insert or update.

Returns ​

true if the operation succeeded; otherwise false.