Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Share ViewModels

$
0
0
Hi,

Based on my understanding, you are trying to save the data of each view model into a XML file. If this is your scenario, I think that a possible solution could be to use a shared service, which will be in charge of managing the process of saving this data. You should inject the service into each view model so that when you want to save the data, the view model will pass the information you want to save to the service and this one will then manage the saving. This way, the process of saving data to a XML file is decoupled from the view model.

A possible way to implement your shared service could be to use a queue to save the information of each of your view models in order so you can access and write the XML file one view model at a time. Therefore, you will avoid multiple simultaneous writings on the XML file that could cause to save wrong information.

Please let us know if we have misunderstood your scenario,

Federico Martinez
http://blogs.southworks.net/fmartinez

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>