开发者

What purpose does the InstanceContext serve with Duplex service callbacks?

开发者 https://www.devze.com 2023-02-15 23:37 出处:网络
When using the DuplexFactory its actually possible to directly pass the callback handler, and skip the InstanceContext wrapper. Why then would you ever use the InstanceContext for your cal开发者_如何转

When using the DuplexFactory its actually possible to directly pass the callback handler, and skip the InstanceContext wrapper. Why then would you ever use the InstanceContext for your cal开发者_如何转开发lback handler?

I am looking for real world examples of how you would use the InstanceContext. It bugs me that I can see it in the API but its not explained anywhere how it adds value, or enables new scenarios.


This might help you - link

The link tells that... "Actually, the WCF Instancecontext class is just a wrapper over the underlying instance that implements the callback interface. So if you want to reuse/share the InstanceContext between multiple client proxies, you need to keep reference to the certain object that implements the callback interface. Thus, whenever you need to create a new client proxy of the duplex service(that need a callback instanceContext), you can just construct a new one with the existing class instance that implements the callback interface."

0

精彩评论

暂无评论...
验证码 换一张
取 消