You should be able to add factory delegates for components instead of real components. NInject supports binding delegates out of the box through its own Bind<>().ToMethod().
The good thing about this design is that you get the benefits of implementing the constructor and at the same time allow the instance ( MasterEnginein this case) to control when instantiating the dependencies.
:
public MasterEngine(IInputReader inputReader,
Func<MasterEngine,GraphicsDeviceManager> graphicsDeviceFactory,
Func<MasterEngine,GamerServicesComponent> gamerServicesFactory)
{
this.inputReader = inputReader;
graphicsDeviceManager = graphicsDeviceFactory(this);
Components.Add(gamerServicesFactory(this));
}
, factory, imo :
Bind<Func<MasterEngine, GraphicsDeviceManager>>()
.ToMethod(context => engine => new GraphicsDeviceManager(engine));
Bind<Func<MasterEngine, GamerServicesComponent>>()
.ToMethod(context => engine => new GamerServicesComponent(engine));
:
public delegate GraphicsDeviceManager GdmFactory(MasterEngine engine);
public delegate GamerServicesComponent GscFactory(MasterEngine engine);
...
Bind<GdmFactory>()
.ToMethod(context => engine => new GraphicsDeviceManager(engine));
Bind<GscFactory>()
.ToMethod(context => engine => new GamerServicesComponent(engine));
...
public MasterEngine(IInputReader inputReader,
GdmFactory graphicsDeviceFactory,
GscFactory gamerServicesFactory)
{
...
}