Entity Framework Extensions BatchTimeout

Description

Batch timeout is the number of seconds for the operation to complete before it times out.

The BatchTimeout gets or sets the maximum time in seconds to wait for a batch before the command throws a timeout exception. The following example modifies the timeout to 180 seconds when bulk saving data.

context.BulkSaveChanges(options => options.BatchTimeout = 180);

Try it: EF Core | EF6

You can also set batch size globally using EntityFrameworkManager.BulkOperationBuilder.

// Global
EntityFrameworkManager.BulkOperationBuilder = builder => builder.BatchTimeout = 180;

Purpose

Having access to change the BatchTimeout gives you the flexibility required when some operations are too slow to complete due to several reasons such as:

  • Batch Size
  • Column Size
  • Latency
  • Trigger
  • Etc.

Contents

Related