- Main Features
-
Bulk Options
- Bulk Options
- Audit
- Batch
-
Column
- Column Input Expression
- Column Output Expression
- Column InputOutput Expression
- Column PrimaryKey Expression
- Column Synchronize DeleteKey Subset Expression
- Ignore OnInsert Expression
- Ignore OnMergeInsert Expression
- Ignore OnMergeMatched AndCondition Expression
- Ignore OnMergeMatched AndOneNotCondition Expression
- Ignore OnMergeUpdate Expression
- Ignore OnSynchronizeInsert Expression
- Ignore OnSynchronizeMatched AndCondition Expression
- Ignore OnSynchronizeMatched AndOneNotCondition Expression
- Ignore OnSynchronizeUpdate Expression
- Ignore OnUpdate Expression
- Ignore OnUpdateMatched AndCondition Expression
- Ignore OnUpdateMatched AndOneNotCondition Expression
- MergeMatched AndCondition Expression
- MergeMatched AndNotCondition Expression
- SynchronizeMatched AndCondition Expression
- SynchronizeMatched AndOneNotCondition Expression
- UpdateMatched AndCondition Expression
- UpdateMatched AndOneNotCondition Expression
- Coalesce Destination OnMergeUpdate Expression
- Coalesce Destination OnUpdate Expression
- Coalesce OnMergeUpdate Expression
- Coalesce OnUpdate Expression
- Context Factory
- Execute Event
- ExplicitValueResolutionMode
- Identity
- Include Graph
- ForceValueGeneratedStrategy
- Key
- Logging
- Rows Affected
- Temporary Table
- Transaction
- Transient Error
- SQL Server
- Coalesce
- Coalesce Destination
- Delete Matched and Condition
- Delete Matched and one NOT Condition
- Delete Matched and Formula
- Matched and Condition
- Matched and one NOT Condition
- Matched and Formula
- Batch Operations
- Events
- Utilities
- C# Eval Expression
30% OFF - 10th Anniversary discount on new purchases until December 15 with code: ZZZANNIVERSARY10
Entity Framework Extensions Coalesce OnMergeUpdate Expression
Description
The CoalesceOnMergeUpdateExpression
allows you to not update any column if the specified value is null
and its database value is not null when BulkMerge
method is executed.
The following example will update only those columns in which the specified value is not null.
using (var context = new EntityContext()) { var list = context.Customers.ToList(); list.ForEach(x => { x.Name += "_Updated"; x.Description = null; x.IsActive = false;}); list.Add(new Customer() { Name ="Customer_C", Description = null, IsActive = false}); context.BulkMerge(list, options => { options.CoalesceOnMergeUpdateExpression = c => new {c.CustomerID, c.Description}; }); }
- It will update only
Name
andActive
columns because the new specified values are null. - The new value for
Description
is null so it will not update theDescription
column.
Author: ZZZ Projects