How to track state of the models?

Topics: Prism v4 - Silverlight 4
Jan 1, 2011 at 10:51 AM

Hello and happy new year,

 

I am new to Prism and have been reading the documentation about the many features. It is fascinating how many problems I had in the past are addressed here.

One thing that I still am missing and had many problems in the past are states of models and how to update them back into the database. I am not sure if Prism solves this problem and I am 95% through all documentation without having found any reference to it.

Lets assume I would like to use Entity Framework 4 to connect to my Database.  Within my DAL layer I would have to convert the data from EF4 entities into my models (MVVM) correct?

But once a model (representing a row in in a table) has been deleted, modified or inserted, how do I write these changes back to EF4 DAL layer?  

Or

Unless I should treat my EF4 entities as models and I am meant to build my ViewModels around EF4 Entities directly, which would then track the changes all the time.

I would appreciate it if you could advice me on this regarding a good strategy,

Regards

Developer
Jan 3, 2011 at 3:03 PM

Hi,

I'm glad you've found Prism useful to address your problems. As for the requirement you're mentioning, you might find WCF RIA Services useful.

From the description in the site above, "Microsoft WCF RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier."

Additionally, if you have any problem specifically related to WCF RIA Services, you might find support in its forum.

I hope you find this helfpul.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi