Skip to content

DmUpsertOptions`1 ​

Namespace: MJCZone.DapperMatic.Dml

Assembly: MJCZone.DapperMatic

Summary ​

How an upsert finds a conflicting row and what it does to it.

sealed public

Contents ​

Constructors (1) | Methods (4) | Properties (4)

Constructors ​

DmUpsertOptions`1 ​

csharp
DmUpsertOptions`1()

Methods ​

GetType ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()

Properties ​

OnConflict ​

Gets the columns a conflicting row has the same values in, <c>u => u.Email</c> or <c>s => new { s.Day, s.Page }</c>; null for the primary key. They must be the primary key or the columns of a unique constraint or index, which PostgreSQL and SQLite need. MySQL and MariaDB update on a duplicate of any unique key.

Type: Expression&lt;Func&lt;T, object?&gt;&gt;?

OnConflictConstraint ​

Gets the name of the unique constraint or index a conflicting row violates, in place of OnConflict.

Type: string?

Update ​

Gets the columns to set on a conflicting row, from the row as it is and the row being upserted: <c>(current, incoming) => new PageStat { Views = current.Views + incoming.Views }</c>. Null sets every column but the key and the conflict columns to the incoming row's values.

Type: Expression&lt;Func&lt;T, T, T&gt;&gt;?

UpdateWhere ​

Gets a condition a conflicting row is updated only when it holds: <c>(current, incoming) => incoming.Version > current.Version</c>. When it does not, the row is left as it is.

Type: Expression&lt;Func&lt;T, T, bool&gt;&gt;