Entity Framework Extensions Ignore OnUpdate Expression

The IgnoreOnUpdateExpression allows you to ignore some columns when the BulkUpdate method is executed.

The following example ignores the CreatedDate property when bulk update operation is performed.

using (var context = new EntityContext())
    var customers = context.Customers.ToList();
    customers.ForEach(x => 
        x.Name += "_Updated"; 
        x.Description += "_Updated"; 
        x.CreatedDate = DateTime.Now; 
        x.ModifiedDate = DateTime.Now; 
        x.IsActive = false; 

    context.BulkUpdate(customers, options => 
        options.IgnoreOnUpdateExpression = customer => new 

Try it in EF6 | Try it in EF Core

  • It will update data in all the columns except for the CreatedDate column because CreatedDate property is specified in IgnoreOnUpdateExpression.