Entity Framework Timeouts

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Entity Framework Timeouts

Message par Clippy »

Entity Framework Timeouts
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Entity Framework Timeouts

Message par Clippy »

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;

```
Répondre

Revenir à « .NET & C# »