Entity Framework Timeouts
Entity Framework Timeouts
Entity Framework Timeouts
Re: Entity Framework Timeouts
There is a known bug with specifying default command timeout within the EF connection string.
[http://bugs.mysql.com/bug.php?id=56806](http://bugs.mysql.com/bug.php?id=56806)
Remove the value from the connection string and set it on the data context object itself. This will work if you remove the conflicting value from the connection string.
Entity Framework Core:
```
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;
```
[http://bugs.mysql.com/bug.php?id=56806](http://bugs.mysql.com/bug.php?id=56806)
Remove the value from the connection string and set it on the data context object itself. This will work if you remove the conflicting value from the connection string.
Entity Framework Core:
```
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;
```