I'm currently writing a GUI desktop application that may become quite large with a lot of module. I'm using caliburn.micro for bootstrapping, MVVM needs and DI.
Regarding the design, I was wondering : what are the good practice regarding the boostrapping process and dependency injection ? what is not enough and what is too much ?
First I'm registering services that would be used through my application. that's I would say the easy part:
container.Singleton<IWindowManager, WindowManager>();
container.Singleton<IEventAggregator, EventAggregator>();
container.Instance<ILoggerFactory>(loggerFactory);
container.Instance<IConfiguration>(config);
But then when It gets a little bit more complicated is for all my viewmodels : Should I Initialize everything in the bootstrapper ? Should I only initialize the main components and let them pass the references to subviews in a more traditional way? (I chose the latter, but it feels sometimes wrong).
An idea that feels good in theory but that I could not find a proper way to implement is to setup a bootstrapper for any loaded module. However, it seems for now to bring more problems than solutions...
Is there good practice regarding this process ? Does anyone have some pointers regarding the design of this kind of application ?
Thank you,
Aucun commentaire:
Enregistrer un commentaire