MVVM woes

MVVM woes

Old forum URL:

Jav posted on Wednesday, June 09, 2010

My needs for MVVM are quite modest.  I realize that "no code left behind" Smile should be the ultimate goal but right now all I want to do is to primarily have the ViewModel as a replacement for CslaDataProvider and store some temporary information that otherwise I would have stored in the objects.

While working with the attached sample (I am thinking that it got attached, but I am not sure), and also with my project I have had some difficulty.  My problem with installing the project on the "staging" server may also stem from the same issues.

The sample does not work. This is because while ViewModel is in place, the Model has not been created.  And that is because for some strange reason I can't create my little TestObject. Go figure! (I am still working on it)

I am going to try and send the sample again just to make sure it arrives. Nope. I got an eror again.  The zipped file is 5 MB, may be that is too big.  Three attempts at file upload unsuccessful.

I'll appreciate any help.


RockfordLhotka replied on Thursday, June 10, 2010

For a "root" viewmodel, I usually create the model object in the viewmodel's constructor. For a "child" viewmodel, I usually require that the model be passed into the viewmodel's constructor. Either way, the creation of the viewmodel ensures that it contains a model.

Copyright (c) Marimer LLC