Windows Scripting
  Home arrow Windows Scripting arrow Page 6 - WCF and Proxies
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

WCF and Proxies
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2007-10-18

    Table of Contents:
  • WCF and Proxies
  • Programmatic Client Configuration
  • WCF Architecture
  • The InProcFactory Class
  • Binding and Reliability
  • Requiring Ordered Delivery

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    WCF and Proxies - Requiring Ordered Delivery


    (Page 6 of 6 )

    In theory, the service code and the contract definition should be independent of the binding used and of its properties. The service should not care about the binding, and nothing in service code pertains to the binding used. The service should be able to work with any aspect of the configured binding. In practice, the service implementation or the contract itself may depend on ordered delivery of the messages. To enable the contract or service developer to constrain the allowed bindings, WCF defines the DeliveryRequirementsAttribute:

      [AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface
                    
    AllowMultiple = true)]
      public sealed class DeliveryRequirementsAttribute : Attribute,...
      {
        
    public Type TargetContract
        
    {get;set;}
        
    public bool RequireOrderedDelivery
         {get;set;}

         //More members
      }

    TheDeliveryRequirementsattribute can be applied at the service level, affecting all endpoints of the service, or only at the endpoints that expose a particular contract. When applied at the service level, it means that requiring ordered delivery is an implementation decision. The attribute can also be used at the contract level, affecting all services that support that contract. When applied at the contract level, it means that requiring ordered delivery is a design decision. Enforcing the constraint is done at the service load time. If an endpoint has a binding that does not support reliability, or supports reliability and has reliability disabled, or has reliability enabled yet ordered delivery is disabled, loading the service will fail withInvalidOperationException.

    The named pipe binding satisfies the ordered delivery constraint.

    For example, to demand that all endpoints of the service, regardless of contracts, have ordered delivery enabled, apply the attribute directly on the service class:

      [DeliveryRequirements(RequireOrderedDelivery = true)]
      class MyService : IMyContract,IMyOtherContract
      {...}

    By setting theTargetContractproperty, you can demand that only endpoints of the service that support that contract be constrained to have reliable ordered delivery:

      [DeliveryRequirements(TargetContract = typeof(IMyContract)
                          RequireOrderedDelivery = true)]
      class MyService : IMyContract,IMyOtherContract
      {...}

    By applying theDeliveryRequirementsattribute on the contract interface, you place the constraint on all services that support it:

      [DeliveryRequirements(RequireOrderedDelivery = true)]
      [ServiceContract]
      interface IMyContract
      {...}

      class MyService : IMyContract
      {...}

      class MyOtherService : IMyContract
      {...}

    The default of theRequireOrderedDeliveryisfalse, so merely applying the attribute has no effect. For example, these statements are equivalent:

      [ServiceContract]
      interface IMyContract
      {...}

      [DeliveryRequirements]
      [ServiceContract]
      interface IMyContract
      {...}

      [DeliveryRequirements(RequireOrderedDelivery = false)]
      [ServiceContract]
      interface IMyContract
      {...}


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This article is an excerpt from the book "Programming WCF Services," published by...
     

    Buy this book now. This article is excerpted from chapter one of Programming WCF Services, written by Juval Lowry (O'Reilly, 2007; ISBN: 0596526997). Check it out today at your favorite bookstore. Buy this book now.

    WINDOWS SCRIPTING ARTICLES

    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH
    - Advanced Word Object Scripting
    - Reading and Printing Word Documents in WSH
    - Scripting Microsoft Word
    - Using WSH to Catalog MP3 Files
    - Reading MP3 ID3 Tags in WSH
    - A Brief Look at Menus in WPF
    - More Examples of Simplified Image Processing...
    - Completing a WPF To-Do List Application
    - Simplified Image Processing in GDI+





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT