Otis wrote:
Well, the calling thread creates a dataaccessadapter, calls a method and the method returns. This can only be done if the actual fetch is done by a background thread. (IMHO). Then the call comes back, but the caller might already be gone somewhere else as the asp.net page thread is back in the threadpool. My head hurts when I even think about the consequences.
Ahhh... its not quite so tricky
My understanding of the new ASP.NET features goes something like this:
1) ASP.NET receives a request which invokes an async page (IAsyncHttpHandler behing the scenes...)
2) The page is invoked as normal and the developer has added a couple of async calls to one of the 3 new async page methods provided by the framework. For example we add 3 fetches to the async task list.
4) The framework now handles the execution of each of the async calls, you don't have to worry about it. Under the covers ASP.NET will call execute each request until it is blocked by IO and and will automatically wire the IO completion port.
5) The ASP.NET thread is now handed back to the pool
6) When all outstanding async calls have completed or timed out the framework then wires up a new ASP.NET thread to complete the page request.
So maybe there isn't a need for Begin/End methods on the Adapter for the ASP.NET example... But there might be a need for thread safety on the objects involved...
As I said... I'm going to do some work in this area and will let you know how I get on...
Marcus