WCF - separating service contracts and partial deriving?
- by dwhittenburg
So, I've seperated my WCF service contracts into discrete contracts for re-use.
I use to have IOneServiceContract that contained 3 functions: Function1, Function2, Function3.
I've seperated this service contract into two discrete service contracts: IServiceContract1 and IServiceContract2. IServiceContract1 contains Function1 and IServiceContract2 contains Function2 and Function3. This will allow me to re-use the discrete IServiceContract1 and/or IServiceContract2 to build a new service contract that represents the contract for the public service.
Knowing this...and hopefully I haven't messed up the description so that you can't follow the rest...
I have two services IService1 and IService2.
IService1 implements IServiceContract1 and IServiceContract2. This works perfect as IService1 needs to implement all of the functions: Function1, Function2, Function3.
IService2 however doesn't need to implement all of the functions of IServiceContract2, only Function1.
Is there a way for IService2 to partially implement the contract? I know that sounds ridiculous. Is the correct way to handle this situation to try and logically separate IServiceContract2 so that IService2 only has to implement the pieces that it needs?
Thanks