Gopinath
Gopinath

Reputation: 1858

In Entity Framework Code First(DbContext) how to handle Azure connection faults & retrys?

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

Answers (2)

Marthijn
Marthijn

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

Related Questions