Page 1 of 1

Increasing the CommandTimeout value

Posted: Tue 20 Jan 2009 21:52
by larrydhunt
I am using MySQL 5.0.51b-community-nt on Windows XP. I used the Entity Developer Database Reverse Engineering Wizard to create a DataContext class. When running Linq query against a large database (4 GB) I am getting the following error after 30 seconds:
Devart.Data.MySql: "Lost connection to MySQL server during query"

Is there a way to increase the CommandTimeout value?

Thanks,
Larry

Posted: Wed 21 Jan 2009 09:31
by AndreyR
You can manually modify the DataContext.cs class like the following:

Code: Select all

public class MySqlDataProvider1: Devart.Data.MySql.Linq.Provider.MySqlDataProvider {

    protected override IDbCommand CreateCommand(string commandText, IDbConnection connection) {
      Devart.Data.MySql.MySqlCommand cmd = new Devart.Data.MySql.MySqlCommand(commandText, (Devart.Data.MySql.MySqlConnection)connection);
      cmd.CommandTimeout = 0;
      return cmd;
    }
}

	[ProviderAttribute(typeof(MySqlDataProvider1))] 
	public partial class CrmDataContext : Devart.Data.Linq.DataContext