Increasing the CommandTimeout value

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Posts: 10
Joined: Tue 20 Jan 2009 21:40

Increasing the CommandTimeout value

Post by larrydhunt » Tue 20 Jan 2009 21:52

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?


Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 21 Jan 2009 09:31

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;

	public partial class CrmDataContext : Devart.Data.Linq.DataContext

Post Reply