각 서비스는 항상 고유 한 종점을 가지며 서비스 내의 구현 된 각 서비스 계약에는 자체 종점이 필요합니다.
이 경우에는 외관이 필요합니다. Employee.Service와 Customer.Service의 로직을 래핑하는 단일 계약의 단일 서비스를 갖게됩니다.
가장 간단한 구현은 같은 것입니다 :
public interface ICustomerService { ... }
public interface IEmployeeService { ... }
[ServiceContract]
public interface IService : ICustomerService, IEmployeeService { ... }
// Your WCF service
public class Service : IService { ... }
지금 Service
모두 ICustomerService
또는 IEmployeeService
인터페이스를 구현 할 수 있습니다 또는 그냥 내부적으로 일부 구현의 인스턴스를 만들 수 있습니다 위임처럼 호출
public class Service : IService
{
private CustomerService customerService;
public Service()
{
customerService = new CustomerService();
}
public Customer GetCustomer()
{
retunr customerService.GetCustomer();
}
}
내가 할 수있는 이거 맘에 들어? <서비스 이름 = "YourNamespace.YourServiceImplementation"> <엔드 포인트 이름 = "SingleInterface" 주소 = "HTTP : //YourServer/Services/IServices.svc" 바인딩 = "은 BasicHttpBinding" 계약 = "YourNamespace.IService "/> –
CodeMaker