Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the specific content of WFC framework

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you the specific content of how to analyze the WFC framework. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

The WFC framework integrated development environment includes many new and improved features to improve productivity. IDE has also been redesigned to provide developers with direct access to .NET Framework components.

In WCF, we can specify callbackContract to service contract for callback, and the callback interface is implemented by the client. To illustrate, we designed a simple scenario. Scenario description: assume that WCF service provides a simple AddTo (), that is, for accumulation. The client consumes the service through proxy and publishes the results to all other clients that have registered the callback channel.

The callback API is designed as follows:

[ServiceContract (CallbackContract=typeo (ICaculatorCallBack), SessionModeSessionMode=SessionMode.Required)] public interface ICaculatorService {[OperationContract (IsOneWay=true)] void AddTo (int n); [OperationContract (IsOneWay=true)] void Register ();}

The callback API and service contract are very simple. Here is a brief description of serviceType:

About AddEventHandler:

When the client invokes the AddTo service, the server starts to calculate, and when the calculation is complete, it then broadcasts and invokes the callback implementation of each client. In order to capture the calculated action, we must define a type of event handle and declare the corresponding type of event, so in this case we define an event OnAddCompleted of type AddEventHandle.

So when was the OnAddCompleted event triggered? Is when the client consumes the AddTo service. WFC Framework We can see from the AddTo implementation that we first save the settlement result, create a new custom event, save the calculation result to the event Args, and then start broadcasting the event (BroadAddEvent). The purpose of broadcasting this event is to get all clients that have registered the event (that is, consuming the Register service) to start calling their event handler (CaculatorService_OnAddCompleted). In the event handler, then start calling the client's WFC framework.

This is the whole process of broadcasting using the WFC framework mechanism.

The above is the editor for you to share how to analyze the specific content of the WFC framework, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report