With WebServices in 2.0 where the proxy classes is created to allow you to
make a WebMethod call Asynch, when the delegate is called does it execute
on the background thread or the foreground thread? In other words in the
example below, will the wsWebServicePro xy_SendMessageC ompleted be executed
on the same thread as the Foo() method?
Is there any need to unhook the EventHandler once the delegate has finished
executed *or* will the gc clean it up *or* does it depend on if the
wsWebServicePro xy's scope (i.e. if it's a local to the Foo() method or
global to the class?
private void Foo()
{
wsWebServicePro xy.SendMessageC ompleted += new
SendMessageComp letedEventHandl er(wsWebService Proxy_SendMessa geCompleted);
wsWebServicePro xy.SendMessageA sync(oMessage);
}
private void wsWebServicePro xy_SendMessageC ompleted(object sender,
SendMessageEven tArgs e)
{
//Execute any code after the WebMethod call has completed
//Does code executed here need to be Invoked to execute on the
foreground thread?
//Is this needed or does this depend on the scope of the
wsWebServicePro xy object?
((WebServicePro xy)sender).Send MessageComplete d -= new
SendMessageComp letedEventHandl er(wsWebService Proxy_SendMessa geCompleted);
}
TIA
make a WebMethod call Asynch, when the delegate is called does it execute
on the background thread or the foreground thread? In other words in the
example below, will the wsWebServicePro xy_SendMessageC ompleted be executed
on the same thread as the Foo() method?
Is there any need to unhook the EventHandler once the delegate has finished
executed *or* will the gc clean it up *or* does it depend on if the
wsWebServicePro xy's scope (i.e. if it's a local to the Foo() method or
global to the class?
private void Foo()
{
wsWebServicePro xy.SendMessageC ompleted += new
SendMessageComp letedEventHandl er(wsWebService Proxy_SendMessa geCompleted);
wsWebServicePro xy.SendMessageA sync(oMessage);
}
private void wsWebServicePro xy_SendMessageC ompleted(object sender,
SendMessageEven tArgs e)
{
//Execute any code after the WebMethod call has completed
//Does code executed here need to be Invoked to execute on the
foreground thread?
//Is this needed or does this depend on the scope of the
wsWebServicePro xy object?
((WebServicePro xy)sender).Send MessageComplete d -= new
SendMessageComp letedEventHandl er(wsWebService Proxy_SendMessa geCompleted);
}
TIA