The situation is thus:
I have an app that is using DI all the way through.
It has 50+ top level classes that manage the app and make calls to an "uploader" portion", which has 20-30 classes involved.
My problem is that I want to basically fork the uploader portion, and run one upload task per "CharacterizationUnit", which I read an unknown number (less than five) of from a database. Nearly all the methods need to have access to the CharacterizationUnit they are operating over, so I'm passing it through pretty much every method, which seems silly.
It seems to me that it would be much nicer to have an instance of each class involved in the upload process for each CharacterizationUnit so that they can keep a reference to it as a member variable to avoid passing it around.
Does this seem like a case where I might want to add a nested container per CharacterizationUnit, so I can register it and inject it to all of my uploader services? An annoying thing being that I then have to pass through a large portion of my root container's registrations to have access to them in the child..
Am I missing a simpler/more sensible approach, such as somehow scoping these services together?
The main thing I'm unsure of in terms of creating a scope and scoping them together is figuring out how to associate the CharacterizationUnit with the scope.
I could also register a whole bunch of factories to map the CharacterizationUnits to corresponding services, but making 20-30 factories that pass almost all of each classes dependencies seems really annoying.
I'm using SimpleInjector and C#.
The answer I believe is that I should have made each unit get it's own process. I haven't implemented that yet, but it seems that would have made the most sense..