No problem. C# has too many ways to do async nowadays and it can definitely be confusing
On Jan 12, 2011, at 7:54 AM, Wayne Douglas wrote: > thanks for that > > i def was getting it all mixed up - the only other time ive done async > services is on the iPhone using monotouch :) > > > On Wed, Jan 12, 2011 at 1:17 PM, Craig Neuwirt <[email protected]> wrote: > 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<IWcfAsyncCall<TResult>>, state > 2) AsyncCallback, state > > Option 1 is the standard async pattern and would look like this > > _actService.BeginWcfCall(x => x.GetAct(new GetActRequest > { > ActName = > > saveScheduleSlotRequest.ScheduleSlot.ActProxy.Name > }), (IAsyncResult > result) => > { > var > response = _actService.EndWcfCall<GetActResponse>(result); > // Do > something with the response > }); > > 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. > > _actService.BeginWcfCall(x => x.GetAct(new GetActRequest > { > ActName = > > saveScheduleSlotRequest.ScheduleSlot.ActProxy.Name > }), > (IWcfAsyncCall<GetActResponse> result) => > { > var > response = result.End(); > // Do > something with the response > }); > > The choice of which approach depends entirely on your preference of the > c#standard async pattern. > > -craig > > On Jan 12, 2011, at 2:42 AM, Wayne Douglas wrote: > >> this also doesn't work: >> >> _actService.BeginWcfCall(x => x.GetAct(new GetActRequest >> { >> ActName = >> >> saveScheduleSlotRequest.ScheduleSlot.ActProxy.Name >> }), (result) => >> { >> var >> async = (GetActResponse)result.AsyncState; >> >> }, >> _actService); >> >> >> complains about an ambiguous call? >> >> 2011/1/12 Wayne Douglas <[email protected]> >> i'm probably being dumb here, but how do i get to the result of this call? >> >> _actService.BeginWcfCall(x => x.GetAct(new GetActRequest >> { >> ActName = >> >> saveScheduleSlotRequest.ScheduleSlot.ActProxy.Name >> })); >> >> i've tried passing in an anonymous method as the callback: >> >> _actService.BeginWcfCall(x => x.GetAct(new GetActRequest >> { >> ActName = >> >> saveScheduleSlotRequest.ScheduleSlot.ActProxy.Name >> }), (result)=> >> { >> >> }); >> >> but something isn't right... >> >> 2011/1/10 Krzysztof Koźmic <[email protected]> >> >> Not very in depth but should get you going: >> >> http://stw.castleproject.org/%28S%28oewxzuymrpqmz045nacayyq2%29%29/Windsor.WCF-Facility-Async-Calls.ashx >> Krzysztof >> >> >> >> On 11/01/2011 6:23 AM, Wayne Douglas wrote: >> >> Hi >> >> 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? >> >> >> -- >> Cheers, >> >> w:// >> -- >> You received this message because you are subscribed to the Google Groups >> "Castle Project Users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/castle-project-users?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Castle Project Users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/castle-project-users?hl=en. >> >> >> >> >> -- >> Cheers, >> >> w:// >> >> >> >> -- >> Cheers, >> >> w:// >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Castle Project Users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/castle-project-users?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. > > > > -- > Cheers, > > w:// > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
