The situation is:
- Application in C# / .NET
- MVVM pattern is used
- A bootstrapper is implemented, using a ServiceLocator implemented with Microsofts Unity framework
- Simplified, there are four basic libraries: UI.dll (Containing ViewModel and View), Data.dll, HardwareAbstraction.dll and Starter.exe
The starter.exe contains the bootstrapper setting up the ServiceLocator. UI.dll then gets the data interface from the ServiceLocator.
In the ViewModel, it is needed to display some data, as soon the data arrived from the hardware. The flow of data is: scanner like hardware -> HardwareAbstraction.dll -> Data.dll -> UI.dll. From one dll to the next, an event is fired to notify the listener that new data has arrived.
Where is the best place to register the event handlers to these events?
There is no real concept for this at the moment in the application, a lot is done in constructors, but it does not seem correct to me. Having them in constructor, often breaks my unit tests (introducing unit tests in existing application) and design time ViewModels (in C#, not Xaml).
Aucun commentaire:
Enregistrer un commentaire