views:

247

answers:

2

I'm building Silverlight applicaitions using Prism and MVVM.

When calling WCF services on your own server, or even external webservices like the Bing api, would this be done from the Model? or from the ViewModel, thus making the service the Model?

A: 

Yes. The View should only manage the transformation of data into user interface elements, the Controller should only orchestrate the interaction between views and model, and the remaining (business logic and data access, this one including calls to remote services) should be in the Model.

Konamiman
A: 

Sorskoot,

For your scenario, I create a Services class that interfaces with WCF. My ViewModels then interface with service.

Also, with silverlight introducing Silverlight 4, you may want to create your own models and use converters to convert the WCF objects going into your app so you have a level of separation. Plus you can start utilizing features such as IDataErrorInfo, INotifyPropertyChanged.

Search on Cinch. It's not Silverlight compatible but will give you an idea of what I'm referring too. Look at DataWrappers.

frosty