New Posts New Posts RSS Feed: Best way to detect loss of connection?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Best way to detect loss of connection?

 Post Reply Post Reply
Author
chuckc View Drop Down
Groupie
Groupie


Joined: 27-Feb-2010
Posts: 54
Post Options Post Options   Quote chuckc Quote  Post ReplyReply Direct Link To This Post Topic: Best way to detect loss of connection?
    Posted: 10-Mar-2010 at 1:57pm
What's the recommended way to detect absence or loss of a data connection?

I see a number of examples in the documentation dealing with saving and restoring cache contents, but they are all driven by user actions. I'd like to recognize at application start-up that a database connection is not available and immediately restore from a saved cache file. I'd also like to recognized when a connection has been lost during a session, and save cache contents to disk at that time.

Thanks!
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 11-Mar-2010 at 9:19am
To determine whether you can immediately connect to a database use this EntityManager constructor:
 
Syntax
Visual Basic (Declaration)  
Public Function New( _
   ByVal shouldConnect As Boolean _
)
 
Visual Basic (Usage) Copy Code
Dim shouldConnect As Boolean
 
Dim instance As EntityManager(shouldConnect)
 
C#  
public EntityManager(
   bool shouldConnect
)
 
Parameters
shouldConnect
True if a connection to the EntityServer should be made.
Exceptions
Exception Description
IdeaBlade.Core.IdeaBladeException Thrown for miscellaneous initialization failures
EntityServerException Thrown for connection failures
ArgumentException Thrown in a Silverlight application when BOS is not specified
 
Once you have created an EntityManager, you can check the IsConnected property of the EntityManager:
 
 IsConnected                                             Returns whether the EntityManager is currently connected to an EntityServer.
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down