I wonder how to split layers of MVVM project properly. For sure i will have to include Service/Business Layer because of a lot of stuff doing there and UI will be relatively simple.
-
Can Services be included into diffrent ViewModels or one service should be only included in one ViewModel ? f.e. If i have functionality of text parser which should operate in some UserControls across application - In this matter, is this parser called Service and i can use it in diffrent ViewModels ?
-
Simmilar question to Models - can one ViewModel include different Models as its fields? Or Model Class should include all fields for according ViewModel ? I think i can use some Models in one ViewModel, please point me on right direction.
-
Should I use Services and Models in ViewModel or only Models in ViewModel?
-
Is data flow from example below correct ? F.e. User clicks/changes something in View, a Command or Binding is called in ViewModel which runs service and returned Value updated fields of ViewModel based on Model ?
-
Should Events be treated as model in matter of placing them in project structure ? I mean, to place all events classes in /Models/Events or just /Events folder ? Also it comes to naming: should i use SomethingHappenedEventModel or SomethingHappenedModel or SomethingHappenedEvent ?
If i'm not understandable, please hit me with some questions. I can provide code examples :)
Aucun commentaire:
Enregistrer un commentaire