Silverlight Data and Controls Series
- Silverlight 4 Hands On Lab
- Silverlight 4 using MVVM Pattern, RIA Services and Custom Domain Service
- Silverlight Custom Authentication Domain Service with RIA Services
- Binding ComboBox and AutoComplete Controls in Silverlight DataGrid
- RIA Service Domain Service Method Life-Cycle
- Silverlight Localization and Resource Files
- Deep Dive into Custom RIA Service and Transactions
- Bind a Silverlight DataGrid Column to the User Control DataContext
- Project RIA Methods
- Silverlight RIA Data Validation Best Practices
Hands On Lab for Silverlight 4
After the Mix 2010 Conference there has been a lot more excitement for Silverlight 4 and RIA Services. If you want to start to learn Silverlight 4 and RIA Services this is what I would recommend. First go the Silverlight website and review some of the learning materials there - there is a ton of good stuff there (http://www.silverlight.net/learn/).
However most of us require a more hands to actually learn something. I recently found that the Swiss MSDN Team published a very detailed Silverlight 4 Hands On lab here - http://blogs.msdn.com/swiss_dpe_team/archive/2010/01/19/hands-on-lab-silverlight-4-line-of-business-application-using-wcf-ria-services.aspx.
This lab is absolutely great in that is over 100 pages of step by step labs that taught me the following:
- How to create a Silverlight and RIA Service Project.
- Created a simple Entity Model and wired up a grid.
- Incorporated both Server and Client side filtering of data in the grid with RIA Services and LINQ.
- Added a Busy Indicator and DataPager controls to the grid.
- Added custom formatting and sorting to grid columns.
- Added an AutoComplete control to filter the grid.
- Added persistence to the grid to perform CRUD operations. Plus added concurrency checking to the grid.
- Created a data form for master and detail data to support for CRUD operations
- Implemented server side validation attributes to domain classes and created custom validation classes.
- Added custom lookups into the data form.
- Created a custom Data Transfer Object (DTO).
- Created custom domain methods.
There were several other labs which I did not complete on:
- New printing capabilities of Silverlight 4.
- Add right click menu items
- Using the clip board.
- Using COM Interop to send data to Excel.
Creating Lab Environment
I really found the labs a great way to learn Silverlight 4.
This lab was built for Silverlight 4 with Visual Studio Beta 2. As you know with the announcements at the Mix Conference, you can now use Silverlight 4 with Visual Studio 2010 RC. Plus a new RIA Service RC was also released. To get started doing this lab do the following:
- Follow instructions here to get your Silverlight 4 environment going with VS 2010 RC - http://timheuer.com/blog/archive/2010/03/15/whats-new-in-silverlight-4-rc-mix10.aspx
- Download the Lab Materials - http://blogs.msdn.com/swiss_dpe_team/archive/2010/01/19/hands-on-lab-silverlight-4-line-of-business-application-using-wcf-ria-services.aspx
Modifications to Lab
Since this lab was published there have been some changes and not all things worked. There were a few small things that you will have to differently to complete the lab. This is because RIA Services RC release changed up several things.
Page 21 – Use System.ServiceModel.DomainServices.Client instead of System.Windows.Ria. Reference - http://code.msdn.microsoft.com/RiaServices/Release/ProjectReleases.aspx?ReleaseId=3570
Page 41 – Use the following for Code Snippet 7 instead of what is provided:
<riaControls:DomainDataSource.QueryParameters>
<riaControls:Parameter ParameterName="city" Value="{Binding ElementName=shipCityBox, Path=Text}" />
</riaControls:DomainDataSource.QueryParameters>
References
- http://forums.silverlight.net/forums/p/155441/347438.aspx
- http://jeffhandley.com/archive/2010/03/15/filters-parameters.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+JeffHandley+(Jeff+Handley)
Page 45 - Data Conflict Detection – This section was seems to be out of place, skip it and complete later.
Page 63 - Snippet 12 – Need to modify the code slightly.
return new ValidationResult("Maximum freight cost for UK exceeded.", new string[] { "Freight" });
1 comment:
Another correction for you:
Page 73, snippet 22, instead of this:
this.ObjectContext.Attach(order);
use this:
this.ObjectContext.Orders.Attach(order);
The former results in an InvalidOperationException (An object with a null EntityKey value cannot be attached to an object context).
Frankly, the best part about labs like this are when they have little issues with them that need to be diagnosed. I know I always get a little more out of them when I need to think about why something isn't working properly rather than just copying and pasting code to see the results.
Post a Comment