Skip to main content
edited body
Source Link
Jesse
  • 321
  • 1
  • 2
  • 7

I'm new to MVVM, I get the general idea, but there's one thing that I've been having a tough time finding an answer for. Inevitably an application will have a save button in the UI. The UI talks to the View Model, the view model updates the model objects, and then the model saves to whatever persistence medium (DB, File System, Web Service...).

My questingquestion is how does this last step happen? Does the View Model get an instance of a DAL object?

public MyVm(IMyModel obj, IDal<IMyModel> dal){ ... }

Or does IMyModel have CRUD methods as part of its interface.

Is it the third option, which is me getting this completely wrong?

I'm new to MVVM, I get the general idea, but there's one thing that I've been having a tough time finding an answer for. Inevitably an application will have a save button in the UI. The UI talks to the View Model, the view model updates the model objects, and then the model saves to whatever persistence medium (DB, File System, Web Service...).

My questing is how does this last step happen? Does the View Model get an instance of a DAL object?

public MyVm(IMyModel obj, IDal<IMyModel> dal){ ... }

Or does IMyModel have CRUD methods as part of its interface.

Is it the third option, which is me getting this completely wrong?

I'm new to MVVM, I get the general idea, but there's one thing that I've been having a tough time finding an answer for. Inevitably an application will have a save button in the UI. The UI talks to the View Model, the view model updates the model objects, and then the model saves to whatever persistence medium (DB, File System, Web Service...).

My question is how does this last step happen? Does the View Model get an instance of a DAL object?

public MyVm(IMyModel obj, IDal<IMyModel> dal){ ... }

Or does IMyModel have CRUD methods as part of its interface.

Is it the third option, which is me getting this completely wrong?

Tweeted twitter.com/StackSoftEng/status/868191675872534528
edited title
Link
Jesse
  • 321
  • 1
  • 2
  • 7

MVVM Persistence from view model and persistence

Source Link
Jesse
  • 321
  • 1
  • 2
  • 7

MVVM Persistence from view model and persistence

I'm new to MVVM, I get the general idea, but there's one thing that I've been having a tough time finding an answer for. Inevitably an application will have a save button in the UI. The UI talks to the View Model, the view model updates the model objects, and then the model saves to whatever persistence medium (DB, File System, Web Service...).

My questing is how does this last step happen? Does the View Model get an instance of a DAL object?

public MyVm(IMyModel obj, IDal<IMyModel> dal){ ... }

Or does IMyModel have CRUD methods as part of its interface.

Is it the third option, which is me getting this completely wrong?