like the title says, I want to keep my logic in a separate project to the service contract(s) so this can stay separate and hidden. I’ve seen it said that this can be done, but I can’t find any examples as to how.
I moved all the necessary code out to a different project, but when I test it only the types are visible to the client, not the methods.
All the methods are marked as [OperationContract] in the interface.
I’m guessing there must be a way of specifically connecting the implementation logic to the contract other than just Class : IInterface, otherwise, what would happen if there were 2 similar classes, e.g.: Class1 : IInterface and Class2 : IInterface? How would WCF know which class to use?
Because you tell it, in the various configuration files.
I can heartily recommend WCF the Manual Way…the Right Way for motivation and a complete walkthrough for what you are trying to do – what I have here is just the pertinent points of such an implementation.
You have three assemblies:
Service,Client,ServiceContracts(interfaces only).ServiceandClientboth referenceServiceContracts.Servicecontains classes implementing the interfaces.Clienthas proxy classes:The client’s
configfile contains an entry pointing at the service’ssvcfile; the service’ssvcfile looks like this:And the service
.svc.csfile looks like:That’s it!