I want to expose my business logic via WCF service in the intranet environment. I have N-tier architecture, pretty simple:
Database -> .Data (DAL) -> .Business (Service Layer) -> WCF
So, far I have 4 services in Service Layer
, but only one WCF service. I here comes the problem. My WCF service uses all 4 services. I'm using Dependency Injection, so technically I should add those 4 services into WCF constructor. I already has parameter for IMapper
, ILogger
and DbContextFactory
.
I was thinking of creating a ServiceFactory and passing it to the WCF service. So then, WCF Service can create whatever service it needs.
But I'm not sure if this is an antipattern or not? What do you suggest?
IMapper
andDbContextFactory
since they are injected into Services themselves and are not needed in WCF service, but it's still 5 parameters. So I have an idea, to create a factory for Services. I'm not sure if this is a good practice though - it sounds like Service Locator anti-pattern, doesn't it?Service Layer
.