Solved

WCF, Silverlight, MVVM

Posted on 2011-03-06
2
932 Views
Last Modified: 2013-03-13
Hi Experts,

I am going through MVVM pattern. I am bit confused in the "Model" part.

Mine is a silverlight data driven project, using WCF, C# and SQL Server.

If we want to implement, where the Model goes?

For example,
1. I am having a customer object, so, defined one customer.cs class as a datacontract and data member in WCF

2. Having customer.xaml (This resides in View Folder of silverlight application)
3. Having a viewmodel folder inside silverlight project, and having customerviewmodel.cs file which creating proxy to the server service(WCF) and access the required methods

4. Having another customer.cs class file inside silverlight project to duplicate the WCF customer.cs datacontract file (or which ever property is required for customer view) and implemented INotify property changed.

Now, my doubt is which is Model as per MVVM?

Customer.cs with Inotify in siliverlight project

Or

Customer.cs datacontract in WCF?

As per MVVM, Model talking abt the property file in server or property file in silvelrightproject?

Thankyou so much.
0
Comment
Question by:RameshLathu
2 Comments
 
LVL 27

Accepted Solution

by:
MikeToole earned 500 total points
ID: 35057261
The ViewModel should be the only thing that the View is aware of. That is where INotifyPropertyChanged would be used to prompt the View to pick-up changed values.
The Model class is the interface to the stored data.
In the simplest case the ViewModel properties can be simple wrappers of the properties provided by the Model class.

Thus:

View <==> ViewModel <==> Model <==> Repository
0
 

Author Closing Comment

by:RameshLathu
ID: 35102188
Thankyou,

I was thinking Model will have the properties with INotify

and

ViewModel class will have all the interaction with the service like WCF
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now