I have a big class hierarchy. When my app starts, I initialize UnityContainer object and configure it. After that I always passing it through constructors to another classes in hierarchy. Something like this :
Unity container has these classes as Registrations: IClassA, IClassB, IClassC, IClassD
All concrete implementations of interfaces have constructor with IUnityContainer parameter. For example,
public class ClassA : IClassA
{
public ClassA(IUnityContainer unityContainer)
{
}
}
So, every time when I'm creating a new instance of some class I must pass an object of IUnityContainer.
May I reduce amount of passing IUnityContainer object as constructor's parameter? Maybe by using Dependency attribute ?