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
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.