Silverlight - Using MVVM pattern with WCF RIA services
I have picked up enough XAML, and Silverlight to write some good code for Silverlight applications. I prefer to use the MVVM pattern in the presentation layer, WCF RIA services for the service layer, and Entity Framework Code First for the data access layer. Getting all of this to work well together is some sort of nightmare for beginners. Sadly, there are no reference implementations either.
Entity framework and RIA uses EntitySet<T> as the collection class. I am more comfortable with ObservableCollection<T> or PagedCollectionView<T>. Even, the MVVM reference implementation - PRISM uses the ObservableCollection<T>.
For data validations, I prefer the IDataErrorInfo interface. This is more preferrable to Data Annotations. With RIA Services, the Entity class is auto-generated. So, I am not sure where I can put in my validations.
Another key problem with using MVVM model for beginners is the navigation. The Silverlight Business Application template solves this problem with the NavigationService class. If you are not using the Silverlight navigation framework and prefer to use the best practices from the PRISM framework, then navigation could be a nightmare. Try putting a simple "Are you sure to delete?" confirmation messagebox using the MVVM pattern.
Overall, learning MVVM, RIA, EFCF and putting them to work together is not the most pleasant experience as a developer. I hope to write a mini-reference implementation soon (A simple CRUD interface in Silverlight using MVVM, RIA, and EFCF).
Category : Silverlight
This is 100% the troubles I'm going through. Waiting for your guide with baited breath...
Data validations in Silverlight is no fun. Check out these articles:
http://wildermuth.com/2009/10/05/What_Do_We_Want_in_Silverlight_Validation
http://outcoldman.ru/en/blog/show/260
http://www.wintellect.com/CS/blogs/jlikness/archive/tags/data+form/default.aspx