Class MergeNotMatchedBuilder<TEntity>
Terminal of a full-MERGE WHEN NOT MATCHED [BY TARGET] branch, produced by
WhenNotMatched(). Every terminal returns the originating
MergeBuilder<TEntity> so the branches can be chained.
public sealed class MergeNotMatchedBuilder<TEntity>
Type Parameters
TEntityThe mapped entity type merged.
- Inheritance
-
MergeNotMatchedBuilder<TEntity>
- Inherited Members
- Extension Methods
Methods
ThenDoNothing()
Leaves the unmatched source row unwritten (DO NOTHING; PostgreSQL only).
public MergeBuilder<TEntity> ThenDoNothing()
Returns
- MergeBuilder<TEntity>
The originating merge builder, for chaining further branches.
ThenInsert()
Inserts every writable column of the unmatched source row.
public MergeBuilder<TEntity> ThenInsert()
Returns
- MergeBuilder<TEntity>
The originating merge builder, for chaining further branches.
ThenInsert(Expression<Func<TEntity, object?>>)
Inserts the explicitly assigned columns of the unmatched source row. The lambda body must be an
anonymous initializer or a named initializer assignable to the entity; only the listed columns are
inserted, so every omitted column receives its normal database default, nullability or constraint
behaviour. The proposed-row (excluded) and target rows are not visible here.
public MergeBuilder<TEntity> ThenInsert(Expression<Func<TEntity, object?>> assignments)
Parameters
assignmentsExpression<Func<TEntity, object>>The assignments, for example
source => new { Id = source.Id, Name = source.Name }.
Returns
- MergeBuilder<TEntity>
The originating merge builder, for chaining further branches.
Exceptions
- ArgumentException
The body is not a supported non-empty initializer, or a destination is unknown, duplicated or type-incompatible.
- NotSupportedException
A destination may not be written, or an unavailable role is referenced.