We have a .NET application that runs on Windows Azure and uses NHibernate to connect to the Azure SQL database. Sometimes you need to add retry logic to handle transient failures in SQL Azure, as described here, for example,
http://social.technet.microsoft.com/wiki/contents/articles/retry-logic-for-transient-failures-in-sql-azure.aspx
Can someone tell me how to do this with NHibernate? Ideally, I would like to do this at the NHibernate level and not wrap every call; I was able to do this for another ORM, .netTiers ( http://nettiers.com ), as I will describe here -
http://blog.ehuna.org/2010/01/how_to_stop_getting_exceptions.html
I did a search and found a few answers that mentioned using a custom implementation of the IDbCommand interface -
Intercept SQL statements containing parameter values ββgenerated by NHibernate
But I'm not sure if this works with NHibernate 3.2, and I'm looking for a clear example that I could change.
How can I get NHibernate to repeat Azure SQL calls automatically? Say 3 repetitions, with an expectation of 100 ms between them - after 3 attempts, if it still fails, we should throw an exception.
source share