Entity Framework Extensions Ignore OnMergeInsert Expression

Description

The IgnoreOnMergeInsertExpression allows you to ignore some columns when the BulkMerge method executes the insert statement and these columns will only be used in update statement.

The following example ignores the Description property in insertion and will be considered when updating the records.

using (var context = new EntityContext())
{
    context.BulkMerge(list, options => 
    {
        options.IgnoreOnMergeInsertExpression = customer => new 
        {
            customer.CustomerID,  
            customer.Description
        };
    });
}

Try it: EF Core | EF6


Last updated: 2023-03-01
Author:


Contents