In order to process nearly 70K records at a time, I use codefriststoredprocs 2.5.0 with my application. With few records everything works fine but with large set of data, I receive "The wait operation timed out" exception. I tried modifying default command timeout value from 30 seconds to 600 seconds in following manner.
//Previous approach
((System.Data.Entity.Infrastructure.IObjectContextAdapter)this.db).ObjectContext.CommandTimeout = 600;
//New approach for EF 6
this.db.Database.CommandTimeout = 600;
but still receives connection timeout message after 30 seconds. I also modified web.config setting Connection timeout value to 600 seconds (I know it is a different thing than command timeout value but give it a go). I feel like the issue is with codefirststoredprocs library that while executing stored procedure change command timeout value to default. Is there any way to fix this issue or should I go to alternate approach of using stored procedures with my application.
Thanks in advance.
First, I would like to thanks CodeFirstStoredProcs
team for their effort and collaboration to solve this issue.
I guess, as mentioned earlier, the command timeout values might have been defaulted to 30 seconds inside CodeFirstStoredProcs
library.
With their new release (version 2.6),they have added ‘command timeout’ parameter to the CallStoredProc<>
method, that helped me set a default value for commandtimeout
and finally solved my issue.
To process nearly 70K records in my case, I set CommandTimeout = 0
to CallStoredProc<>
method. This adds an infinite waiting time to execute stored
procedure.
Thanks once again for CodeFirstStoredProcs
team. :)