Solved

WCF, Silverlight, MVVM

Posted on 2011-03-06
2
934 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 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