Search
Latest Articles
Richard Costall - Richard receives an new version of the Packt title Silverlight 5 Data and Services Cookbook. How does it measure up, Buffet or Banquet?
Richard Costall - Richard Costall's just released his second article covering Silverlight Out-Of-Browser, featuring Elevated Trust on the Simple Talk Website.
Skip Navigation Links
Login / Register
Article Quote
Microsoft Silverlight 4 Data and Services Cookbook is a great publication, and worthy of a place any Silverlight developers bookshelf.
Richard Costall
 Member Quotes
 Latest Articles
Silverlight 5 Data & Services Cookbook
Richard receives an new version of the Packt title Silverlight 5 Data and Services Cookbook. How does it measure up, Buffet or Banquet?
Silverlight OOB - Article 2 on SimpleTalk
Richard Costall's just released his second article covering Silverlight Out-Of-Browser, featuring Elevated Trust on the Simple Talk Website.
Man V Review Challenge
It's the Man V Review Challenge Richard Costall V 1,700 pages of APress's C# 2010 Platter feast for 10 -There can be Only 1 Winner.
APress XNA 3.0 Programming review
Richard gets his hands on a slightly old, but non the less useful book on XNA programming, find out what his thoughts were....
Silverlight Out Of Browser
Richard Costall's just released an article covering Silverlight Out-Of-Browser Basics on the Simple Talk Website.
Articles...
Conferences Conferences
Mix11
Mix11
Partner Showcase Partner Showcase
Ridgian are a leading IT solutions provider, delivering business centric solutions.
Ridgian are a leading IT solutions provider, delivering business centric solutions.
Powered by ASP.NET 2.0
NxtGenUG Article
Richard Costall Thursday, May 13, 2010
Richard puts Packt's Silverlight 4 Data and Services Recipes book through it's paces, but how does it fair against Richard's Challenge
The Article 
Title: Microsoft Silverlight 4 Data and Services Cookbook
Author : Gill Cleeren, Kevin Dockx
ISBN: 1847199843 - 978-1-847199-84-3
Packt Publishing April 2010
Buy/Pre-Order from Packt
Microsoft Silverlight 4 Data and Services Cookbook
Microsoft Silverlight 4 Data and Services Cookbook
Packt publishing has just released a new Silverlight 4 book, focusing on Data and Services in Silverlight 4. The functionality that now exists, around these areas in Silverlight 4, now makes it a very compelling technology for building business applications. Not only can Silverlight deliver rich media services, and viral games, it also has extensive functionality around consuming services, rendering and editing data, via a series of rich controls, and Validation. So it’s not surprising this title was released to bring all these elements together in a ‘Recipe Book’
That’s right, this book is not a traditional ‘read though’, but more a collection of 85 how-tos, organized into 10 chapters. So for this review I tried a different approach… Before opening the book I made-up 12 scenarios which, as a user, I may want to solve, to see how the book fares in my ‘Challenges’

1) I have a Boolean property to which I need to Databind to a visual elements Visibility property and have a mismatch

2) I need to save my data somewhere locally for offline scenarios

3) I need to call a third party web-site to consume a service, but get an exception

4) I’d like to change the DataForm to be customized in Edit View

5) My Website has authentication and I’d like to exploit the Application services for Roles/Profile information in my Silverlight Application

6) I want to use MVVM, and in particular want to understand Commanding

7) I need to make a WebRequest and pass user credentials in the call

8) I’m hearing a lot about WCF RIA services – how does this make my life easier

9) I have a collection of items, and control over the collection type, what’s my best approach for DataBinding

10) I want to bind my Slider to the Angle property of a RotateTransform – Can I do this in Silverlight 4

11) If the value of the object I am binding to is Null how can I provide a default value?

12) The Silverlight Grid supports ‘*’ for column sizes, how do I do this in the DataGrid

Chapter 1 – Nuts and bolts of Silverlight 4

The opening chapter serves as a bit of a primer for people who haven’t really used Silverlight – It explains the tools you need, and the architecture of a Silverlight. Even as a opening chapter, I felt the coverage was good here, covering some of the issues, such as configuring MIME types on IIS when deploying the application, and also you can change the .XAP extension to .ZIP and it will still work.
Challenges Complete: 0/12

Chapter 2 - Databinding

In Chapter 2 we delve straight into Databinding, with a well written and concise overview, before getting into a Simple example. I like how the book highlights the differences between Silverlight 2/3 and 4 (for example FrameworkElement v DependencyObject). The opening code sample was a bit too long (4 pages of XAML), but the example worked well. We then have an example of Element to Element binding, before moving on to binding to collections, the different modes (OneTime,OneWay,TwoWay), and also programmatically accessing the DataContext within a button click handler. The chapter is then rounded off by showing Databinding in Expression Blend and how to generate Sample data to appreciate design layout.
Challenges Complete: 1/12

Chapter 3 – Advanced DataBinding

The advanced Databinding gets off to a cracking start with an early challenge completed, explaining about Converters in Silverlight, and swiftly follows up with a recipe for CommandParameters, and BindingBase properties such as StringFormat, TargetNullValue and FormatValue. It then talks about validation and the IDataErrorInfo and INotifyDataErrorInfo interfaces and creating a DataTemplate for the ListBox control. A recipe brings them all together at the end of the chapter.
Challenges Complete: 4/12

Chapter 4 – The DataGrid.

The DataGrid is a powerful control in the Silverlight SDK, and extremely valuable in Data Scenarios. This Chapter kicks off with a sample implementation and highlights the additional assemblies which get including in the XAP package, and the support for UI virtualization. It then moves on with a sample for Updating, Insertion and Deletion of items, before moving on to Sorting and Grouping, all of which are supported by the DataGrid Control. A second control, the DataPager is then added to provide paging support, and the receipe here, highlights the different flavours of default UI for the DataPager. This Chapter also demonstrates the ability to customize the fields using the DataGridTemplateColumn. This chapter scores a late strike with an explanation of column sizing, and support for ‘*’ in the Silverlight 4 DataGrid, before the final recipe highlights a master/detail view scenario.
Challenges Complete: 5/12

Chapter 5 – The DataForm

A quite often overlooked control, the DataForm, is available in the Silverlight Toolkit, which will, given an object (or collection of objects), render the data form for view/edit/deletion, complete with customization and validation support. So it’s not surprising this control has a chapter to itself. The first recipe shows the true power of this control, with a simple example, before changing the Data source to be a collection, and using annotations to change the prompts and descriptions. It then goes on to discuss how you can template the control in Read/Update states, and then demonstrates using Blend to change the overall control, before finishing with Validation of fields.
Challenges Complete: 6/12

Chapter 6 – Talking to Services

“No Silverlight application is an island” – is what I like to say, and Chapter 6 tells us how to get off the island by talking to Services. It’s nice the first recipe is ASMX, as that’s a common question I get asked at user group presentations. It then also demonstrates calling a service to update data, before moving on to talk about Cross Domain calls and the impact on Silverlight, in both In Browser, and out-of-browser elevated Silverlight applications. The chapter then provides a recipe for using the HttpWebRequest to consume an XML feed. It’s nice how each example here, is simple yet covers a different aspect, asmx, wcf, objects, XML, request types. As RSS consumption example demonstrates the SyndicationFeed object, before a demonstration of aggregation of multiple feeds. There’s a demonstration of Sockets, before a couple of recipes on Talking to Azure.
Challenges Complete: 7/12

Chapter 7 – Talking to WCF and ASMX Services

Chapter 7 is a deep dive into WCF and ASMX, covering consuming and handling faults, increasing performance with Binary XML and using Duplex communication. It then provides recipes on Debugging, Encrypting and Security of messaging, and creating service references from the command line.
Challenges Complete: 7/12

Chapter 8 – Talking to Rest and DataServices

Chapter 8 focuses on talking to REST based services in both XML and JSON format. It then talks about ‘ADO.NET Data Services’ as was, before focusing on examples which consumes images from Flickr and content from Twitter. There’s a nice little diversion onto Out-Of-Browser Elevated applications and awareness of being offline, or installed before showing how to inject authentication details into the WebClient
Challenges Complete: 8/12

Chapter 9 – Talking to WCF RIA Services

WCF RIA Services is a framework to make building business applications easier, and is the focus of Chapter 9. The first recipe gets us up and running with WCF RIA Services, before bringing in an example of Sorting and Filtering to a DataGrid. It then covers the updating of data back to the database and using the authentication services to track the user using the application and securing the services on the webserver. It then looks at the DomainDataService. I would have liked to see a ‘custom’ entity in this section, and working with Stored Procedures.
Challenges Complete: 8/12

Chapter 10 – Converting your existing applications to user Silverlight

Chapter 10 is a mixed bag of items, starting with using WCF to call a Stored Procedure on the server and using LINQ to SQL and the Entity Framework in your existing Silverlight application. It wraps up with using the Application Services in ASP.NET to provide Authentication, Roles and Profile support
Challenges Complete: 9/12

Summary

A score of 9/12 in the Challenge is a great result; the only missing items were persisting/reading values and objects to and from Isolated Storage (very briefly touched on in Chapter 6). There was no Commanding or MVVM covered, which is becoming a common requirement in the marketplace, and I’d liked to have seen a custom entity in the RIA services section. Having said that, these are niggles and it’s impossible to cover everything in one book.

Microsoft Silverlight 4 Data and Services Cookbook is a great publication, and worthy of a place any Silverlight developers bookshelf. The formula of ‘recipes’ works well, with well explained, yet simple examples covering almost everything you’d ask when starting out building business applications in Silverlight. It highlights Silverlight 2 and Silverlight 3 functionality differences, yet is right up to date on Silverlight 4.
About Richard
Richard Costall (MVP, MCSD.NET) has over 22 years development experience and works for 1st Software, a Microsoft Gold Partner, and the UK's leading software solution for Financial Adviser and Intermediaries, designing and implementing IFA applications in the financial services sector. Previously specializing in VB, XML/XSLT, COM, ASP and MSMQ, Richard now lives and breathes the awesome world of .Net and in particular ASP.NET and Silverlight 2.0. Richard spent 5 1/2 years as the Midlands regional coordinator for VBUG (Visual Basic User Group) before co-founding NxtGenUG, the innovative UK user group for Microsoft Technologies.

Richard has written articles for publications such as ASP.NET Pro and International Developer Magazines and also co-authered the Apress title Professional MSMQ. He speaks a local user groups, Microsoft Conferences/Product launches, TechED Europe and the hugely successful DeveloperDeveloperDeveloper Events.

When not in .Net land, Richard enjoys relaxing at home with his wife and two sons, playing on the XBOX 360 or ultimately jetting off to Walt Disney World, Florida, for a trip on the Tower of Terror.

Copyright © 2006-2009 NxtGenUG - Powered by ASP.NET 3.5