In February and March I wrote five good posts with samples about WCF RIA Services Beta. I have refreshed all these samples to work with WCF RIA Services v1.0. I have tested almost all new WCF RIA Services RC1/RC2/v1 features, too. In the near future I’ll write three posts about WCF RIA Services v1.0 features and various extensions. Today I’ll present first part of it.
I sign changes in my samples:
- migration changes & new features
- migration changes
Let’s start …
1. BusinessApplicationDemo
If a large number of entities can be returned, consider paging on the client by throttling the results. Now, you can use the ResultLimit property on the QueryAttribute.
Deepesh Mohnani has written a great post how to use server throttling with DomainDataSource.
BTW, there are many changes in DomainDataSource. It no longer blocks loads when another load is pending. SubmitChanges on DomainDataSource no longer automatically reloads data. Filter/sort/group descriptors support binding. There is ICommand support for Load/SubmitChanges/RejectChanges. For more details, read breaking changes.
In the latest RIA Services bits, the total server count of the resulting query is not requested by default for paging scenarios. To explicitly request that the Count method is called, you can set the IncludeTotalCount property on the EntityQuery to true. Deepesh Mohnani has a great post about it here.
DomainDataSource will not request for count in non-paging scenarios. As soon as a page size is specified, DomainDataSource will set the IncludeTotalCount property on the EntityQuery for you. By subscribing to the LoadingData event on the DomainDataSource you can override this behavior.
To reduce the load on the middle tier and database you can use the OutputCacheAttribute attribute for output caching. Now, clients can cache the response because communication between the client and server has been changed from SOAP with binary encoding (only POST) to REST with binary encoding (GET or POST).
In the current release, validation rules are enforced by raising events through the INotifyDataErrorInfo interface.
When you create a custom validation class or attribute, you must now pass to the Silverlight application the name or names of the members that failed validation (with the ValidationResult).
BTW, you can write custom authorization rules, just like validation. There’s extensible AuthorizationContext. See CustomAuthorization (ala CustomValidation) attribute written by Nikhil Kothari.
Now, you can very easily perform async validation. The RIA Services Entity class has the ValidationErrors collection to manipulate the errors at any time. When you call Add, Remove, or Clear on the collection, it translates that into the necessary INotifyDataErrorInfo events. Simply modifying the collection will result in the UI showing the updated errors. Jeff Handley writes about it here. BTW, his async validation example contains the CustomValidation attribute which is different approach than you see below.
Some good links about validation
- Silverlight 4 + RIA Services - Ready for Business: Validating Data
- RIA Services and Validation
- Async Validation with RIA Services
2. ConflictsExamples
Support for LinqToSql classes is now only available in the WCF RIA Services Toolkit.
Resolve methods for resolving conflicts in different types of DALs are not supported in this release of WCF RIA Services.
I have added second version of my example with concurrency conflicts - with Entity Framework.
In the current release, the entire original entity is not sent to the server for concurrency checks any more. Now, you can specify which members are sent to the server by marking them with the RoundtripOriginal attribute. In addition, any members that are marked with the ConcurrencyCheck attribute or the TimeStamp attribute are automatically sent to the server.
3. WindowsAuthentication
4. HttpsExample
5. CrossDomainExample
6. RIAServicesLibrariesDemo
7. MultipleDomainContextsExamples
All samples from part one you can download here
Useful links
Start, doc & samples
- http://www.silverlight.net/getstarted/riaservices/
- http://msdn.microsoft.com/en-us/library/ee707344(VS.91).aspx
- Breaking Changes from Beta(PDC 09) to RTW
- Getting Started - RIA Services HRApp Walkthrough
- WCF RIA Services Code Gallery
MIX 10
- CL08: Microsoft Silverlight 4 Business Applications
- CL09: Developing with WCF RIA Services Quickly and Effectively
- CL50: Search Engine Optimization for Microsoft Silverlight
Channel 9
- Jeff Handley on WCF RIA Services for Silverlight 4
- Pete at Microsoft: WCF RIA Services Team Interview
Silverlight TV
- Silverlight TV 18: WCF RIA Services Validation
- Silverlight TV 20: Community Driven Development with WCF RIA Services
- Silverlight TV 26: Exposing SOAP, OData, and JSON Endpoints for RIA Services
- WCF RIA Services v1.0 Launch! (Silverlight TV 28)
TechEd 10
Silverlight 4 Hands on Labs
- Silverlight Business Apps: Module 2 - WCF RIA Services, Creating and Editing Data, and Data Binding
- Silverlight Business Apps: Module 2.1 - WCF RIA Services
- Silverlight Business Apps: Module 2.2 - Using WCF RIA Services to Edit Entities
- Silverlight Business Apps: Module 2.3 - Showing Master/Details Records Using WCF RIA Services
Blogs & Sites
- http://blogs.msdn.com/b/brada/
- http://www.nikhilk.net/
- http://jeffhandley.com/
- http://blogs.msdn.com/b/deepm/
- http://blogs.msdn.com/b/kylemc/
- http://mtaulty.com/
- http://weblogs.asp.net/fredriknormen/
- http://www.riaservicesblog.net/Blog/
- http://johnpapa.net/
- http://briannoyes.net/
- http://www.silverlightshow.net/
- http://10rem.net/blog
- http://blogs.msdn.com/b/wpfsldesigner/
- http://weblogs.asp.net/scottgu/
- http://tomasz.janczuk.org/
- http://timheuer.com/blog/
- http://blogs.msdn.com/b/silverlightws/
- http://blogs.msdn.com/b/scmorris/
Cheers and enjoy!!