Say I have a call like so:
_actService.BeginWcfCall(x => x.SaveAct(new SaveActRequest
{
Act = act
}));
How do I get to the response of SaveAct? How can I set up a callback to fire when the operation completes?
I have tried:
_actService.BeginWcfCall(x => x.GetAct(new GetActRequest
{
ActName =
saveScheduleSlotRequest.ScheduleSlot.ActProxy.Name
}), (result) =>
{
var async = (GetActResponse)result.AsyncState;
}, _actService);
But it complains about an ambiguous call?
Any pointers?
Craig Neuwirt answered this: http://groups.google.com/group/castle-project-users/browse_thread/thread/f440dbd05e60484f
I think you may be a little confused about the normal C# async pattern. It always involve a pair of Begin/End calls.
The WCF Facility support 2 callback models which is determined by the last 2 arguments of your BeginWcfCall
The 2 options are 1) Action>, state 2) AsyncCallback, state
Option 1 is the standard async pattern and would look like this
As you can see, the first requires a reference to the _actService proxy to call end. The first is a convenience method which does not.
The choice of which approach depends entirely on your preference of the c#standard async pattern.