What are the ways where a viewmodel can get business logic. Lets say, I have 3 Models and based those 3 models data I will produce(basically calculation) some new values(lets say model 4) where I will show this Model 4 data in View.
Note I can not put calculation logic on service side because i dont have control..on them. I have to compute Model 4 on my side.. Where should I compute this Model 4 Values?
Questions 1) Is it good practice to call Service form ViewModel i.e GetModel_1_Data,GetModel_2_Data, GetModel_3_Data if not whats the good practice ?
2) As per mvvm I am not allowed to have business logic on ViewModel ...then where should I do? What are different ways we can achieve..this ?
3) In Mvvm I see models consumed by UI basically Models with INotifyPropertychanged .. what is the right word to call them.. can I call as UI Models? or UI model objects? Other Models just like plain CLR objects.
when I read about mvvm many say to keep logic in Model..whic model ..does they mean plain clr classes..or UI models(where they have INotifyPropertyChanged) If not do we need to have some layer to produce UI Models from POCO models? What this layer is called
UI handles the presentation responsibility, business layer handles validations and data access layer handles SQL.
The advantages of 3 layer architecture are as follows:-
•Contained changes: -Changes in one layer do not replicate across other layers.
•Reusability: -Increased reusability because each layers are separate, self-contained and individual entities.
As far as I know, the MVVM is an evolution of 3 layer architecture.
The following tutorials and example for your reference.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.