I am working on a MVVM project using Entity Framework 5.0.
I connect to a hosted DB and sometimes Entity Framework looses connection to the DB.
What would be the best way to reconnect the connection to the DB when the connection was lost?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When connection is broken during saving your changes you simply get exception. Whole saving is done in transaction which is not committed due to the exception and EF doesn’t mark its current changes set as completed. You can simply try to save changes again when that specific exception happens – EF will try to open a new connection and execute the same transaction
for ex.:
well, maybe something like this: