I'm finding I'm adding lots of layers of callbacks (and complexity) when executing commands on my BO and I'm wondering if there is a way to add some standard convention to the ViewModelBase such that it can wrap the async calls to a command object much in the same way it wraps the static factory calls.
I've seem to be calling a command on a child BO, so I wrap it in a call from my parent BO, which in turn has a call back so that my UI ViewModel knows it is done, which in turn might be a child of another ViewModel.
Some of it needs refactoring know that I have a better handle on MVVM but I would really like to try and stop replicating all these function calls in all my layers.
At the end of the day I need my VM to know that an error occurred so I can display something pretty for the users and deal with the issue.
I'm wondering if something like DoRefresh() -> OnRefreshed() but DoExecute() -> OnExecuted();
Maybe I'm missing the point that this can also be handled another way...
That's an interesting idea - I hadn't really thought about a viewmodel that wraps/manages a command object.
It sounds a bit like the Rx scenario post you quoted the other day.
It would just make for a simple and clear implemenation with a single spot to code for errors/returns from the UI perspective and leaves the BO layer to not have to worry about doing extra legwork so the UI can also find out what happened.
I agree - I added it to the wish list - probably something you'll see in a 4.0.x release.
Copyright (c) Marimer LLC