Q:

Dependency Injection - is this how it's meant to look?

Our project is using constructor-based Dependency Injection (we're using Unity as our container) and we have a number of constructors which have acquired a large number of parameters.
For example:
    public FooRequestService(
        ITransactionDataBuilder transactionDataBuilder,
        IMapper<SaveFooRequest, FooRequestMessage> saveFooRequestToFooRequestMapper,
        IFooRequestedThingRepository fooRequestedThingRepository,
        IFooRequestedThingBuilder fooRequestedThingBuilder,
        IMapper<IEnumerable<FooRequestedThing>, IEnumerable<FoundFooRequestedThing>> fooRequestedThingsToFoundFooRequestedThingsMapper,
        IAutomatedFooWcfService automatedFooService,
        IFooArrivalMessageProvider fooArrivalMessageProvider,
        ISeatCancellation cancellation,
        IPostSalesService postSalesService,
        ITransactionEnquiryService transactionService,
        IMapper<IEnumerable<FooRequestedThing>, List<ThingArrivedForFoo>> thingArrivalRequestDocumentMapper,
        IMapper<SaveFooRejected, FooRejectedMessage> saveFooRejectedToFooRejectedMapper,
        IPartialFooConfiguration partialFooConfiguration,
        ICurrentDateTimeProvider currentDateTimeProvider,
        IMapper<FooRequestMessage, List<FooRequested>> tracsFooRequestMapper,
        IThreeWayMerger<Transaction, TransactionService.Contract.Transaction, NotifyFooRequestedRequest, SaveFooRequest> saveFooRequestMerger,
        KioskWebServiceSoap kioskServiceGateway)
    {
        // code here to set injected values to member variables
    }

This class has a total of around 370 lines of code and represents a core part of the system, hence the large number of dependencies.

From a DI perspective, is is usual to have so many parameters passed to a constructor?
The general approach concerns me from an encapsulation and scoping aspect. All dependencies can be used from anywhere within a class, even if they should (strictly speaking) only be used from, for example, a single method

A:

Yes, this is the right approach. If you have so many dependencies in your class, maybe you should review your system architecture/design (maybe you can split the class in more smaller classes; it's just a suggestion, your class may be fine already), but from the DI point of view, it is ok.

