Entity Framework Extensions Column InputOutput Expression

The ColumnInputOutputExpression allows you to choose specific properties in which you want to perform the bulk operations with the direction InputOutput.

The key is required for operation such as BulkUpdate and BulkMerge. The following example uses CustomerID, Description, IsActive properties in the ColumnInputOutputExpression.

using (var context = new EntityContext())
    List<Customer> list =  new List<Customer>() { new Customer() { Name ="Customer_A", Description = "Description" , IsActive = false }, 
    new Customer()  { Name ="Customer_B", Description = "Description", IsActive = true },
    new Customer() { Name ="Customer_C", Description = "Description" , IsActive = true }};
    context.BulkMerge(list, options => 
        options.ColumnInputOutputExpression = c => new 

Try it in EF6 | Try it in EF Core

  • It will merge data for CustomerID, Description and IsActive fields and all other properties will remain NULL in the database.
  • It will also update the list by updating only the specified properties from the database.