event based model client and ChannelFactory<T>
Hallo again my question regards to event based model client development in WCF service client infrastructure. what I would lice to know is that, instead of开发者_Go百科 using ClientBase is it possible to manually implement this patten with ChannelFactory so for example I could write GetDataAsync for client access and still using ChannelFactory and implementing serverside async calls here?
The answer will depend on whether you control the service contract or not. If you can define the service contract then you add the appropriate begin/end methods that return/use the IAsyncResult as shown in the code in this blog post.
If you can't change the service contract then you must create an async version of the service contract manually and feed that to the ChannelFactory. The ChannelFactory itself does not provide an async mode of service operation invocation. Your code will end up looking something like the code in this MSDN sample.
精彩评论