I am fairly new with WCF, I'm looking to share a service contract and data contracts between service in one solution and a service consumer in another solution. I have created a seperate project which is shared between both solutions that contains both the service contracts and the data contracts. When i reference my service The data contracts are being shared but not the service contract. My contract looks like the following:
[ServiceContract]
public interface IDistributionService
{
[OperationContract]
[ServiceKnownType(typeof (Distribution))]
bool AddDistributions(Distribution[] oDistributions);
}
When I look at the reference.cs file I is using the Distribution objects but it's generating the IDistributionService contract again, here is an excerpt of the reference.cs file:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="eDistributorService.IDistributionService")]
public interface IDistributionService {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDistributionService/AddDistributions", ReplyAction="http://tempuri.org/IDistributionService/AddDistributionsResponse")]
bool AddDistributions(mhcb.syd.eDistribution.WebServices.Contracts.DTO.Distribution[] oDistributions);
}
Is there any way of getting the consumer to use the IDistributionService interface without generating the concrete instance in the reference.cs file?
The main reason I want to know is so that I can use dependency injection (unity).
.RegisterType<IDistributionService, DistributionServiceClient>(
new Interceptor<InterfaceInterceptor>(),
new InterceptionBehavior(container.Resolve<IInterceptionBehavior>()))
Thanks again!