BrainDump
  Home arrow BrainDump arrow Page 3 - Handling Multiple Contracts with Indigo
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 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
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? 
BRAINDUMP

Handling Multiple Contracts with Indigo
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-05-15

    Table of Contents:
  • Handling Multiple Contracts with Indigo
  • Proxy Generation for Multiple Contracts and Endpoints
  • Sharing Service Contracts
  • Summary

  • 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


    Handling Multiple Contracts with Indigo - Sharing Service Contracts


    (Page 3 of 4 )

    This lab illustrates an alternate approach for sharing metadata with the client. Instead of generating a proxy using SvcUtil, a class library containing only service contracts is shared by the service library and the internal client application. This approach is useful in an environment where you own both sides: client and service. This approach can simplify steps in development, help you avoid the internal complexity of types generated by SvcUtil, and even allow you to exercise more control over service contract versioning on both ends.

    Realistically, remote clients such as Internet clients may not be owned, which is why the more traditional approach of sharing contracts via add service reference is used.

    Duplicating Operations

    This lab illustrates exposing two different contracts on each service. These contracts each have unique operations: a set for the business functionality exposed by the service, and a set for administrative functions. You may also want to expose a subset of business operations for external clients while exposing the complete set of business functionality to internal clients.

    To achieve this, you could create internal and external interfaces for the service contract, for example:IServiceAandIInternalServiceA. The external interface,IServiceA, would in this case contain a subset of the functionality exposed byIInternalServiceA(see Example 1-28).

    Example 1-28. Internal and external service contracts with duplicate operations

    [ServiceContract(Namespace = http://www.thatindigogirl.com/samples/2006/06)] public interface IServiceA
    {
     
    [OperationContract]
     
    string Operation1();
     
    [OperationContract]
     
    string Operation2();
    }

    [ServiceContract(Namespace = "http://www.thatindigogirl.com/samples/2006/06")] public interface IInternalServiceA
    {
     
    [OperationContract]
     
    string Operation1();
     
    [OperationContract]
     
    string Operation2();
     
    [OperationContract]
     
    string Operation3();
    }

    If you expose each of these contracts on their own service types (ServiceAandInternalServiceA, respectively), external clients will never see the functionality exposed to internal clients because they work from a different WSDL document. However, the implementation can still be the same for each service implementation.

    The following sample illustrates the scenario:<YourLearningWCFPath>\ ServiceContracts\ Samples\ InternalExternalServiceTypes.sln.

    More BrainDump Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Learning WCF A Hands-on Guide," published...
     

    Buy this book now. This article is excerpted from chapter 1 of the book Learning WCF A Hands-on Guide, written by Michele Leroux Bustamante (O'Reilly, 2007; ISBN: 0596101627). Check it out today at your favorite bookstore. Buy this book now.

    BRAINDUMP ARTICLES

    - XAML Brushes and Silverlight
    - Silverlight and XAML Basics
    - Immortal XP
    - XAML Basics
    - Microsoft Surface
    - Making Your First Active X Control in Visual...
    - Codes and Packages in Microsoft Project 2007
    - Windows 7: Rumors and Demos
    - XP SP3 Why Me?
    - Breaking Up Your Work in Microsoft Project
    - Breaking Work into Task-Sized Chunks
    - Putting Microsoft`s Worldwide Telescope Unde...
    - Handling Multiple Contracts with Indigo
    - Cleaning Out Your Data in XP
    - Multiple Service Contracts and Indigo





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