Get the App
SLTechnology News&Howtos  ›  Development  › 

How to analyze the specific content of WFC framework

Shulou Source: shulou.com Published: 2022-06-02 03:04:34 10月30日 Update

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.

Tags: Event client framework client service content broadcast that is interface time type result consumption design analysis program end analysis processing development Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Huawei Xiaomi Apple Redmi