No, it is possible to implement more than one service contract by the type of WCF service (the class that is assigned to the ServiceBehavior attribute), because it is just a matter of having the class implement multiple interfaces. If you use any Visual Studio templates or other code generators, this may not be immediately clear. However, although you can implement more than one Service Contract interface in a service type, it is not very useful if you need a service, presumably a singleton in this case (?), To behave as a single service. IBusinessService implies that you need all of the service functions to be called from the same client proxy, so that all operations can work in the same logical session (similar to the ASPX web session). If this is not the case, then you can define separate proxies for each interface of the contract, but it will also require support for one endpoint for each contract.
Is this an absolute requirement that you can only use for an instance of WCF ServiceHost for your implementation? What factors influence your decision?
By the way, partial classes no longer bother me. The idea of โโsplitting code into multiple files now seems pretty natural. For example, storing partial classes in files such as ServiceType_IProductMgmtBiz.cs and ServiceType_ICustomerMgmtBIZ.cs seems quite natural, in addition to storing the main logic in ServiceType.cs.
Finally, the following question may be useful ... WCF and interface inheritance - Is this a terrible thing?
source share