Page 1 of 1

Setting Timeout in Entity Model

Posted: Thu 15 Dec 2011 21:25
by TonyV
I'v built an entity model for my database using Entity Developer. Everything is running great. However, the default command timeout property for my connection is the default of 30 seconds. This is fine for most of my operations, however, I have a couple of stored procedures that I've mapped to methods that can take a lot longer than 30 seconds to run.

1. Is there a way I can change the timeout for those operations without affecting other "normal" queries?

2. If I set the timeout to 0, will the code wait until the stored procedure finishes and never timeout?

Tony

Posted: Tue 20 Dec 2011 11:42
by Shalex
Please set the "Default Command Timeout=0;" connection string parameter.
TonyV wrote:1. Is there a way I can change the timeout for those operations without affecting other "normal" queries?
The mentioned connection string parameter will affect all the queries.
TonyV wrote:2. If I set the timeout to 0, will the code wait until the stored procedure finishes and never timeout?
It will never timeout.

You can also control the timeout in your code by setting a public CommandTimeout property of ObjectContext.