How would you design business logic interaction with Viewmodel in mvvm


  • 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 ..if so...


    • Edited by nellis2 Saturday, March 18, 2017 8:40 PM
    Saturday, March 18, 2017 8:39 PM

All replies