Class MergeMatchedBuilder<TEntity>
Terminal of a full-MERGE WHEN MATCHED branch, produced by
WhenMatched(). Every terminal returns the originating
MergeBuilder<TEntity> so the branches can be chained.
public sealed class MergeMatchedBuilder<TEntity>
Type Parameters
TEntityThe mapped entity type merged.
- Inheritance
-
MergeMatchedBuilder<TEntity>
- Inherited Members
- Extension Methods
Methods
ThenDelete()
Deletes the matched target row.
public MergeBuilder<TEntity> ThenDelete()
Returns
- MergeBuilder<TEntity>
The originating merge builder, for chaining further branches.
ThenDoNothing()
Leaves the matched target row unchanged (DO NOTHING; PostgreSQL only).
public MergeBuilder<TEntity> ThenDoNothing()
Returns
- MergeBuilder<TEntity>
The originating merge builder, for chaining further branches.
ThenUpdate()
Updates every non-key writable column of the matched row from the source row.
public MergeBuilder<TEntity> ThenUpdate()
Returns
- MergeBuilder<TEntity>
The originating merge builder, for chaining further branches.
ThenUpdate(Expression<Func<TEntity, TEntity, object?>>)
Updates the explicitly assigned columns of the matched row. The lambda body must be an anonymous
initializer or a named initializer assignable to the entity; each binding is
destination = value, where the destination is a mapped CLR property of the entity and the
value may read the pre-update target row (target) and the original input row
(source). Columns that are not assigned are not written at all.
public MergeBuilder<TEntity> ThenUpdate(Expression<Func<TEntity, TEntity, object?>> assignments)
Parameters
assignmentsExpression<Func<TEntity, TEntity, object>>The assignments, for example
(target, source) => new { Total = target.Total + source.Amount }.
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 is identity, computed or the merge key, or a provider does not support the form.
ThenUpdate(Expression<Func<TEntity, TEntity, TEntity, object?>>)
Updates the explicitly assigned columns of the matched row, with the third parameter naming the
provider-native proposed insert row (excluded). A parameter that is never read is accepted;
reading it on a form that has no native proposed row fails before execution.
public MergeBuilder<TEntity> ThenUpdate(Expression<Func<TEntity, TEntity, TEntity, object?>> assignments)
Parameters
assignmentsExpression<Func<TEntity, TEntity, TEntity, object>>The assignments, for example
(target, source, excluded) => new { Count = target.Count + excluded.Count }.
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 the provider has no proposed row for this form.