Testing an Entity Framework database connection

c# database-connection entity-framework mysql testing

Question

I have an app that uses the entity framework to connect to a MySQL database. It functions flawlessly, however I'd like to add a short bit of code that will check the database connection when the app first launches.

I originally thought about just sending a little command to the database and collecting any exceptions, but if there is a problem (such App.Config being missing or the database server being down), the app takes a very long time to run this code and then throw the exception (around one minute). I suppose that connection timeouts and other factors are to blame, but I've played about with these properties to no avail.

Anyone with suggestions about where to go be able to help?

1
37
4/27/2018 3:03:00 PM

Accepted Answer

ZZZ_tmp
46
4/10/2020 1:08:28 AM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow