Answer the question
In order to leave comments, you need to log in
Can Callback act as a ViewModel?
Please tell me Callback on the client can act as a ViewModel-and from the point of view of MVVM? It's just that all of its methods are received as if events are called from the server. At the same time, you can’t push any special logic inherent only to the service into it. (at least in my task) So why not? What's the point that I create events for each function in it and will catch them in the ViewModel? Maybe it's easier to just use it right away as a ViewModel? Well, if (as usual) something is not clear to someone (I already have a presentiment), then here's an example for you. Regular chat. Functions like: client connected / client disconnected, private / public message received, etc. are called on the callback. They are dumb as events. There are no special actions in the callback.
Answer the question
In order to leave comments, you need to log in
VM is an entity that is designed to transfer / display information. It may contain logic to help you do this. Judging by the description, you want to add some piece of logic responsible for notification in the VM, in my opinion this is a bad idea. I think all this should be in business, and there you can already have callbacks and events.
In this case, I do not agree with the user Stanislav Silin .
If everything is as primitive as you describe, then it is quite possible to bind directly to the callback object and not to soar your brain.
Business and DAL layering is done in order to simplify development, support and debugging. If there is nothing to simplify, maintain and debug, then there is no point in duplicating the object's callback logic in another class called BlablablaViewModel.
To Stanislav Silin : The entity for display is View, ViewModel is an entity that opens model data for View and allows you to perform actions on this data (ICommand).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question