I'm currently learning about Unity and so far, everything I tried is working fine and as expected. However, what really bugs me is the injection of dependencies into the constructor.
Consider the following service:
public class ReallyComplexService : IReallyComplexService {
public ReallyComplexService(INeedThisRepo repo1, INeedThisRepo2 repo2, INeedThisRepo3 repo3, IAlsoNeedThisDependency dependencyX, INeedAUnitOfWork uow, INeedCoffeeNow coffee, IShouldBetterAskJonSkeet skeet)
{
this.Repo1 = repo1;
this.Repo2 = repo2;
this.Repo3 = repo3;
this.AdditionalDependency = dependencyX;
this.UnitOfWork = uow;
this.Coffee = coffee;
this.JonSkeet = skeet;
skeet.Ask();
}
}
Services can get reeeeeally big, especially when they're more than just a service layer for some website that is completely functional with writing stuff into / reading from a database. E.g. a Windows service that serves complex tasks (please record that Videostream from this IP camera and notify me if the camera is offline). This may turns constructors into a completely unreadable wall of code.
Is there an alternative way to satisfy the dependencies of a class?