简体   繁体   中英

MVVM Pattern with application services

I am just developing a new WPF application using PRISM. I want to add some application services which will registered using IOC (Unity). My question comes on hor to design these services; Let's imagine that I have some devices to control, monitor, manage...I thought in creating a new IDeviceService but I do not know how to design the interface behaviour, it is, should I have a service instance per device or just one and pass the device Id as parameter?

Another question is what to put in Device model and what to put in Service? And finally, should the service update the model or should be the viewmodel instead?

Thanks!

Look at MediatR. Or create some app service classes. Or create one class per usecase. This just reduces app code in your view model.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM