Hey,
In the application that I'm working on the fetches consist of executing a bunch of SQL statements. Some of these can take a while to run, so we were thinking that providing the user with an overall status of each fetch would be a nice feature (something like a message just before and just after each statement runs).
I was wondering if anyone has considered this before? Is there a way to get a message from the server version of the business object back to the client application midfetch?
Thanks,
Jonathan
Jonathan,
This really is more of a UI design issue than that of your business objects. Theoretically any operation that hits the database could be take a bit of time to execute. In the world of UI, anything that takes more than a second (especially in a WinForms UI) can annoy the user since it freezes up the main UI thread, making the application unresponsive.
A good approach would be to implement the Asynchronous Programming Model pattern in your UI code. It uses a delegate on the client-side to invoke any method on its own thread so you don't tie up the main UI thread. You can then display an hour glass or some kind of status bar.
Now this approach is easy to implement in a WinForms app (which I'm assuming is what you're building). If you're app is ASP.NET, then things get a little more complex. You can use APM but then you need some kind of callback mechanism from the browser to check the status of the request; Ajax works well here. Another approach is to use something like this HTML Busy Box, which throws up a IFRAME with a "please wait" message while the long-running request executes.
~pete
Copyright (c) Marimer LLC