Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
A couple of thoughts here. First, as to the db going away, I can easily imagine this. Most of my users are remote. I.e. they are connecting from hotels, and hot spots at starbucks, from all over the US and occasionally Europe, or using broadband cards. Lots of times these connections are flaky (to put it mildly). Thus, it isn't the db that is going away, but them. They loose connection to, well, just about everything. So I totally see were this would be nice, especially if they are in the middle of editing a record (which in my app's case can take many minutes) when they loose the connection. It would be nice if they were informed earlier rather than later.
If I were to implement this, based on what's been discussed so far, I think I'd have a class to handle the check. I'd run an asynch thread to check every minute or two. But I'd also be able to call the method synchronously from my BaseBO (as Trent suggested). That way if they are in a long edit, they'd get informed before a save failed, but I'd also be checking before access in order to gracefully inform the user of the issue. I'm just throwing out ideas here. Figure I might have to do this one day myself!
Also, note that if you using Enterprise Server, the Connection test won't work (last time I tried, I couldn't get a connection from an ES DbDataSourceItem). You'll need to run a real fast query instead. Could be something as simple as Select 1. This would just make sure you can connect (with a real small timeout). I'm not sure how to manipulate the ES timeout at runtime though...
I might also consider making this check configurable, so if the user knows they have high availability, they could turn it off. Finally, you might also consider handling the errors that come up when the connection is lost, and taking the action you were considering taking (user can hang out and try again (with data related functionality turned off) or just close and loose any changes. Upon further thought, I'd likely start with handling exceptions gracefully, and only add in the other strategies (threading and checks before access via BO) if it seem like I still needed it (I.e. lots of lost edits, connection going south frequently). Threading can be hard to get right, performance issues are likely too.
Just some ideas....
|