How to handle connections with a Winform C# & SQL Server in the cloud connection issues

124 views Asked by At

I have a Winforms application that uses SQL Server in the cloud. Have Dapper handling the data side. I wrapped all my data calls in a try/catch and bubble them up. However, they are sync methods and was thinking about moving to async but the user will just click multiple times with no feedback.

What are the best practices in handling this configuration and should I try to ping the database before each call and then if that returns true execute the method to perform the data operation?

It takes about 30 seconds response if the connection fails and throws a transport error. For example if someone enables or disables a VPN then the connection will be down for a few seconds or where they sleep the computer.

It would be nice to get a message about being offline before performing any actions.

How to efficiently check for a line to the database and handle the result?

0

There are 0 answers