Hi,
I have a nopcommerce 2.3 setup and it has about 7000 products and some complex queries (with filters) need more time than 30 seconds to execute. I was wondering where and how I can change the sql command timeout to 60 seconds.
public virtual void Insert(T entity)
{
try
{
if (entity == null)
throw new ArgumentNullException("entity");
// DBG Added - Increase timeout for inserting into the database
var previousTimeout = ((DbContext) this._context).Database.CommandTimeout;
((DbContext) this._context).Database.CommandTimeout = 120;
this.Entities.Add(entity);
this._context.SaveChanges();
// DBG Added - Revert timeout back to its original value
((DbContext) this._context).Database.CommandTimeout = previousTimeout;
}
catch (DbEntityValidationException dbEx)
{
throw new Exception(GetFullErrorText(dbEx), dbEx);
}
}
public virtual void Update(T entity)
{
try
{
if (entity == null)
throw new ArgumentNullException("entity");
// DBG Added - Increase timeout for updating objects in the database
var previousTimeout = ((DbContext) this._context).Database.CommandTimeout;
((DbContext) this._context).Database.CommandTimeout = 120;
this._context.SaveChanges();
// DBG Added - Revert timeout back to its original value
((DbContext) this._context).Database.CommandTimeout = previousTimeout;
}
catch (DbEntityValidationException dbEx)
{
throw new Exception(GetFullErrorText(dbEx), dbEx);
}
}