Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of programming to realize orderly transfer of WCF

Shulou Source: shulou.com Published: 2022-06-02 11:39:32 09月22日 Update

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.

Tags: Services order contracts properties applications help influence support examples analysis programming content interfaces methods more messages endpoints decisions yes code Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Huawei NVidia MySQL Linux