Multiple WCF Services implementing same Service Contract interface

Posted by andrewczwu on Stack Overflow See other posts from Stack Overflow or by andrewczwu
Published on 2010-04-26T23:30:06Z Indexed on 2010/04/26 23:33 UTC
Read the original article Hit count: 147

Filed under:
|
|

Is it possible for multiple wcf services to implement the same service contract interface?

What I want to do is allow for a test service to be interchangeable for the real service, and to specify which service to be used in the configuration file.

For example: [ServiceContract] public interface IUselessService { [OperationContract] string GetData(int value); }

Test implementation public class TestService : IUselessService { public string GetData(int value) { return "This is a test"; } }

Real class public class RealService : IUselessService { public string GetData(int value) { return string.Format("You entered: {0}", value); } }

© Stack Overflow or respective owner

Related posts about wcf

Related posts about .NET