4

I read about the SQL Azure and Entity Framework Connection Fault Handling article that describes about implementing Retry Policy in OnContextCreated (for ObjectContext). How to achieve the same for Entity Framework Code First DbContext?

2 Answers 2

1

Check out this blog post. It's got the answer you are looking for.

http://blogs.msdn.com/b/cesardelatorre/archive/2012/04/24/entity-framework-code-first-dbcontext-and-sql-azure-connection-fault-handling.aspx

0

I have this problem as well, and I think I have a possible solution. This code by Microsoft can be used to create a reliable connection. In your DbContext class override the constructor to use the reliable connection (see this post for an example). The only problem is Microsoft's connection is an IDbConnection and the DbContext is using DbConnection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.