Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default Entity Framework timeout

What is the default timeout for EF queries? I've tried to find out by checking context.CommandTimeout, but it returns null.

I have also looked in the web config in the connection string for something like Connect Timeout=, but it doesn't seem to be there by default.

like image 760
Johan Avatar asked Nov 30 '12 14:11

Johan


People also ask

What is the default entity framework timeout?

Sometimes, however, you might also want to include a task that requires longer than the default command timeout value (30 seconds in SQL Server) such as importing a lot of data.

What is the default command timeout?

The time in seconds to wait for the command to execute. The default is 30 seconds.

How do I increase timeout in Entity Framework?

You can use DbContext. Database. CommandTimeout = 180; It's pretty simple and no cast required.

Is CommandTimeout in seconds or milliseconds?

The CommandTimeout property sets or returns the number of seconds to wait while attempting to execute a command, before canceling the attempt and generate an error.


1 Answers

The default timeout for object queries and the SaveChanges operation is defined by the underlying connection provider. Since Entity Framework can be used for many connection providers, mysql, sql server etc. and all have different default timeout's!

So null means default timeout will be used, if you want to know what is the default then it depends on the connection provider you are using!

like image 66
Arsalan Adam Khatri Avatar answered Sep 21 '22 01:09

Arsalan Adam Khatri