One of our services is slowly turning into a mega-service where we have 10+ injected services; almost like a facade but not quite.
Are there some proven patterns to handle this specifically in C# / .NET Core? I feel like if we aggregate some of the smaller services it wouldn't lead us to cleaner code, in fact I fear the opposite.
As most of the methods use many of the services if we moved groups of methods out of the service then all we would be doing is creating a slightly smaller mega-service elsewhere in the code.
Code example:
public class FooService
{
private IServiceA _serviceA;
private IServiceB _serviceB;
public FooService(IServiceA serviceA, IServiceB serviceB)
{
_serviceA = serviceA;
_serviceB = serviceB;
}
}
public interface IServiceA
{
}
public interface IServiceB
{
}
I would also be interested to read any research around strategies for handling this type of refactoring or how to tackle it.