Have EF automatically resend queries after various errors

When I execute a command against a redundant SQL configuration (such as SQL Azure), I sometimes get timeouts and other misc. errors that are due to a server being shutdown or failing. On Azure this isn't a problem, since redundancy is built-in. The correct action is to re-attempt the query with a new connection, and most likely the load balancers (or whatever) will kick you over to a server that's functioning properly.

My question is whether there is a way to have Entity Framework (v4 or v5) do this automatically? Wrapping every query with a try/catch block (that reattempts the query if certain errors are received) is impractically, and I feel confident that there's a solution to this problem that I'm overlooking.

For related information about SQL Azure's random closing of connections, see: http://msdn.microsoft.com/en-us/library/ee336245.aspx#cc. However, as of late, I have not gotten this error from Azure at all... I just got the occasional, sporadic SQL timeout.


have a look at the Transient Fault Handling Framework from SQL CAT :


=== Added by @pbarranis ===

According to that same site, but a different page:

The Transient Fault Handling Framework has been superseded by a newer deliverable from the Patterns & Practices team. It is now called the Transient Fault Handling Application Block and comes in all 3 flavors:

•Developer guidance: http://msdn.microsoft.com/en-us/library/hh680934(v=PandP.50).aspx

•NuGet package: http://nuget.org/List/Packages/EnterpriseLibrary.WindowsAzure.TransientFaultHandling

•Source code: http://nuget.org/List/Packages/EnterpriseLibrary.Source.WindowsAzure

The new Transient Fault Handling Application Block is now our officially recommended approach to handling transient faults in the applications running on the Windows Azure platform.

Need Your Help

big endian vs little endian

c++ endianness little-endian big-endian

i work on a 64 bit intel processor...i was learning about big and little endian and what i understood was that these are byte orderings within a word such that in a 64 bit data, msb will have lowest

ExtJS 4 grid - How to paste text at the cursor position in a cell?

extjs grid cursor cell edit

I have a grid panel using the cell editing plugin. Next to this grid there is a collection of links representing available placeholders which can be inserted into the cell.