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

Example Analysis of programming to realize orderly transfer of WCF

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article gives you an introduction to programming WCF orderly delivery example analysis, the content is very detailed, interested partners can refer to reference, I hope to help you.

I think everyone has a certain understanding of WCF, here I will introduce WCF ordered delivery separately, we know that the service code and contract definition should be independent of the bindings and attributes it uses. In fact, either the WCF service implementation or the data contract itself depends on the Ordered Delivery of system messages. To help developers of contracts or services constrain supported bindings, WCF defines the DeliveryRequirementsAttribute class, which is a sealed, non-inheritable class that we use to define the delivery properties of services. Here applied to the service properties, set the service to enable WCF ordered delivery.

[DeliveryRequirementsAttribute( QueuedDeliveryRequirements = QueuedDeliveryRequirementsMode.Allowed, RequireOrderedDelivery = true )] public class WCFService : IWCFService { //Implement methods defined by interfaces public string SayHello(string name) { Console.WriteLine("Hello! WriteLine") {0},Using string ", name); return "Hello! " + name; } //implements the method defined by the interface public string SayHelloToUser(User user) { Console.WriteLine("Hello! {0}{1},Using DataContract ", user.FirstName, user.LastName); return "Hello! " + user.FirstName + " " + user.LastName; } }

DeliveryRequirementsAttribute..::. The RequireOrderedDelivery property sets whether the binding protocol must support sorted messages. This can be applied at the service level, affecting all endpoints of a WCF service, or affecting only endpoints that expose a particular service contract; if applied at the WCF service level, it means that the choice of ordered delivery is an implementation-specific decision. The Delivery Requirements feature can also be applied at the service contract level, affecting all services supporting the contract. The requirement for orderly delivery of WCF is embodied in decisions made according to design. This constraint is enforced and validated when the service is loaded. Named pipe bindings conform to the constraints of ordered delivery.

About programming WCF orderly delivery of sample analysis to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

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