Entity Framework Core 1.0:

this.context.Database.SetCommandTimeout(180);

Entity Framework 6:

this.context.Database.CommandTimeout = 180;

Entity Framework 5:

((IObjectContextAdapter)this.context).ObjectContext.CommandTimeout = 180;

Entity Framework 4 and below:

this.context.CommandTimeout = 180;

Example:

this.db.Database.CommandTimeout = 300; // (60 * 5 min = 300)
this.db.uspMyStoredProcedure();
Last modified: October 31, 2020

Author

Comments

Write a Reply or Comment