Reputation: 1858
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
?
Upvotes: 4
Views: 1106
Reputation: 2139
Check out this blog post. It's got the answer you are looking for.
Upvotes: 1
Reputation: 3392
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.
Upvotes: 0