WCF Architectural Debate
When building a WCF service for a large scale application, which is better:
In both cases, assume that the business logic layer is separated into a different assembly.
Using your business logic layer as a service implementation i.e. with no code behind and no wrapper
<%@ ServiceHost Language="CS" Service="MyApp.BusinessLogic.BusLogicImpl" %>
or
Using the codebehind of the WCF service that wraps ca开发者_运维问答lls into your business logic layer.
<%@ ServiceHost Language="CS" Service="MyApp.WebServiceHost.Service" CodeBehind="Service.svc.cs" %>
If you need to have code behind your service, I would also put that into a separate assembly and store it in the .\bin directory of your ASP.NET website hosting the SVC file - I would never put that directly into a MyService.svc.cs code-behind file.
So you would have something like:
<%@ ServiceHost Language="CS" Service="MyApp.ServiceLayer.MyService" %>
and put all the logic and wrapper code you need (to call your business layer) into that assembly.
精彩评论