F
Frankie
For the first time with my .NET programming endeavors I need to add
asynchronous processing capabilities to a library. Before this I was using
old-fashioned callbacks. Anyway I was just now doing a bunch of research on
my alternatives before I begin to write code. My question below is of a
general level - so I don't think my particular requirements are relevant.
But in case you're wondering, I'm writing a library in support of a Windows
Forms app that, amongst other things, connects to a SQL Server database and
executes bunch of scripts. While those scripts are executing, the Windows
Forms app users should be able to do other work.
Anyway...
According to MSDN online, it appears that there are 2 identified patterns we
can follow when implementing asynchronous processing, in addition to a few
additional techniques [that don't really amount to being patterns].
Beyond simply calling BeginInvoke on a delegate, and dealing with that
scenario, two asynchronous programming design patterns documented in MSDN
online include:
"IAsyncResult Pattern"
and
"Event-based Asynchronous Pattern"
When going to add asynchronous processing capabilities to our libraries,
According to the MSDN docs online (links provided if you want them), we are
supposed to always implement the "event-based" pattern, and only implement
the "IAsyncResult pattern" only if absolutely necessary. MSDN goes on and on
and on about how we should do whatever possible to avoid the "IAsyncResult
pattern", and even when we have to implement it, we have to go through a
bunch of gyrations and STILL ALSO implement the "event-based" pattern.
So that's MSDN. Given the foreboding tone of the MSDN treatment, I looked to
the book Framework Design Guidelines (by Cwalina and Abrams) figuring they'd
shed some light on the subject, and they do. Chapter 9 section 2 presents
ONLY the Async pattern.... nowhere does the book talk about the
"Event-based" pattern glorified by MSDN - at least not that I found. So
apparently the guys who wrote the .NET Framework, itself, don't give a hoot
about this "Event-based" pattern that MSDN suggests will save the world.
So, I'd appreciate some general guidance from those of you who actually have
implemented asynchronous processing in your applications, if such guidance
can be had. I know "it all depends" - but I'd sure appreciate something more
specific than that, if possible.
Thanks!
asynchronous processing capabilities to a library. Before this I was using
old-fashioned callbacks. Anyway I was just now doing a bunch of research on
my alternatives before I begin to write code. My question below is of a
general level - so I don't think my particular requirements are relevant.
But in case you're wondering, I'm writing a library in support of a Windows
Forms app that, amongst other things, connects to a SQL Server database and
executes bunch of scripts. While those scripts are executing, the Windows
Forms app users should be able to do other work.
Anyway...
According to MSDN online, it appears that there are 2 identified patterns we
can follow when implementing asynchronous processing, in addition to a few
additional techniques [that don't really amount to being patterns].
Beyond simply calling BeginInvoke on a delegate, and dealing with that
scenario, two asynchronous programming design patterns documented in MSDN
online include:
"IAsyncResult Pattern"
and
"Event-based Asynchronous Pattern"
When going to add asynchronous processing capabilities to our libraries,
According to the MSDN docs online (links provided if you want them), we are
supposed to always implement the "event-based" pattern, and only implement
the "IAsyncResult pattern" only if absolutely necessary. MSDN goes on and on
and on about how we should do whatever possible to avoid the "IAsyncResult
pattern", and even when we have to implement it, we have to go through a
bunch of gyrations and STILL ALSO implement the "event-based" pattern.
So that's MSDN. Given the foreboding tone of the MSDN treatment, I looked to
the book Framework Design Guidelines (by Cwalina and Abrams) figuring they'd
shed some light on the subject, and they do. Chapter 9 section 2 presents
ONLY the Async pattern.... nowhere does the book talk about the
"Event-based" pattern glorified by MSDN - at least not that I found. So
apparently the guys who wrote the .NET Framework, itself, don't give a hoot
about this "Event-based" pattern that MSDN suggests will save the world.
So, I'd appreciate some general guidance from those of you who actually have
implemented asynchronous processing in your applications, if such guidance
can be had. I know "it all depends" - but I'd sure appreciate something more
specific than that, if possible.
Thanks!