Entity Framework - SQL Azure Retry Policy

前端 未结 5 1420
春和景丽
春和景丽 2020-12-31 05:20

Could anyone guide me how to implement a retry policy with EF to SQL Azure, please.

5条回答
  •  渐次进展
    2020-12-31 06:00

    This Azure Forum thread has some links to good resources that cover this topic. There doesn't seem to be anything 'official' quite yet. But there are some open source projects that give you a pretty good start.

    http://social.msdn.microsoft.com/Forums/en-US/ssdsgetstarted/thread/3a9ed384-5374-438e-a8a4-ff4bd8000738/#27b5251a-bff5-4282-980c-ad43fdd85591

    From the answer:

    http://blogs.msdn.com/b/appfabriccat/archive/2010/10/28/best-practices-for-handling-transient-conditions-in-sql-azure-client-applications.aspx

    I personally didn't use the library the blog mentions. Instead I was able to get away with a simple WHILE LOOP with a TRY/CATCH that watched for the specific SQL EXCEPTION Error Numbers which were safe to retry. There is also a counter which basically prevents it from 'retrying' forever.

提交回复
热议问题