>
 Monday, October 03, 2005
« WCF Coding Practices: Decouple Services ... | Main | Architecture Podcast - relive the podcas... »

Never ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever write service contracts and implementations inline.

With the PDC bits for WCF, using the Indigo Service template is like opening a box of chocolates...you never know what you'll get...IService, IMyService, IIndigoService...but that's just Beta stuff...

For Web sites the template generates the .svc endpoint and service implementation, for other project types it generates only the service implementation. Normally the service implementation would be in a .cs or .vb file (pick your language)...and this is true in all cases but one: adding a new Indigo Service to an existing Web site project in Visual Studio.

This template is evil...it creates inline code like this, with all the implementation in the target IIS endpoint file:

<%@ Service Language="C#" Class="IndigoService" %>

using System;
using System.ServiceModel;

[ServiceContract()]
public interface IIndigoService
{
    [OperationContract]
    string MyOperation1(string myValue);
}

public class IndigoService : IIndigoService
{
    public string MyOperation1(string myValue)
    {
        return "Hello: " + myValue;
    }
}

Now if I want to host this service outside of this Web site application I'll have to copy the service code into another file somewhere, or migrate this code to use a class library and share it. Why would I not just create the service in the class file from the beginning?

This may change before release...but just in case bookmark this post ...

10/3/2005 8:39 AM Indigo  | Comments [3]  |  View reactions  |  Trackback
    ON THIS PAGE
    SEARCH
    CATEGORIES
    ARCHIVES
    BLOGROLL

Designed by NUKEATION STUDIOS