The possible reasons of the "Lost connection to MySQL server during query" error:
connection was closed by MySQL server:
look for any errors in the logs of MySQL server
check the value of wait_timeout variable at your MySQL server
network problems
the issue is specific to dotConnect for MySQL: set "Validate Connection=true;" option in the connection string to validate connection each time on retrieving it from the pool (less performance, should be used in the environment with unstable connections). If "Validate Connection=false;" (default) - connection is validated only in the pool every ~30 seconds (no check no retrieving it from the pool)
If you are explicitly providing plain ADO.NET connection to your DbContext (or ObjectContext) object, take into account the following points:
the MySqlConnection object is not thread safe. You should avoid using the same MySqlConnection in several threads at the same time
you can implement a failover logic in your application:
- http://www.devart.com/dotconnect/mysql/docs/?Devart.Data.MySql~Devart.Data.MySql.MySqlConnection~ConnectionLost_EV.html
- http://www.devart.com/dotconnect/mysql/docs/?Devart.Data~Devart.Common.ConnectionLostCause.html
- http://www.devart.com/dotconnect/mysql/docs/?Devart.Data~Devart.Common.ConnectionLostContext.html