I use Castle Windsor, but I guess this applies to all DI containers...
I often find myself creating internal helper classes and injecting these into other classes. (Actually Windsor doesn't support internal ctrs so I typically end up making the helper classes public, which is my first "code smell").
The helper class may have a number of dependencies of its own, of types already registered with Windsor, so it makes sense (to me) to register the helper class with Windsor too, so I can inject it into the classes that need it. E.g.
public MyService : IService
{
public MyService(MyHelper helper, other dependencies...)
{
}
}
After reading a few articles I'm starting to wonder if this is "misusing" Windsor, or just generally bad code design. If that's the case, how should I deal with helper classes?