January 2009 - Posts

Silverlight 2 Data Form - Episode 6: "C" is for Create

In this episode, you build a XAML form that acts like a popup, modal window. The form validates user input with WCF callbacks to ensure that the customer ID is unique. By the end of the episode, you're able to add a customer to the NorthWind database using Silverlight, VB, ADO.NET Data Services and the Entity Framework.

Here's a reminder: this series is sequential. If you haven't worked through the first five episodes, you'll find this one tough sledding because of the prerequisites.

BTW, if you think these screencasts are worthwhile, let me know?

Ken

Silverlight Streaming Beta Outage

My apologies to those unable to access my screencasts on building a Silverlight 2 data form. The Silverlight Streaming service has been flakey for the last few days and, as I write this, it is non-existent.

Given that the service is free and still in beta, we can't complain (too much) about outages. It would be nice, however to have more frequent status reports. I like the way Messenger shows its current status.

For the time being, all we know is what Remy Pairault (Program Manager for Microsoft Silverlight Streaming by Windows Live)  has posted here: http://dev.live.com/blogs/sls/archive/2009/01/26/452.aspx .

Of course after the beta is over, the uptime of Silverlight Streaming and other Live services will become far more significant. Businesses will need a large degree of confidence in Microsoft's infrastructure before betting their commercial ventures on cloud computing with Azure.

Silverlight 2 Data Form - Episode 5: "D" is for Delete

In software development, learning the 'easy' stuff is a breeze. Pick up most any book or article, or browse to the online help and blogs. It's the hard stuff that authors and bloggers ignore or gloss over, at least in the first edition. It's not difficult to understand why; figuring out complicated tasks requires time-consuming questions, lots of research, and plain ol' trial and error. Deadlines crush the best intentions.

That was my observation when I wanted to know how to delete a customer from the famous Northwind database using VB, Silverlight 2, Entity Framework, and ADO.NET Data Services. I couldn't find anyone who had done it, so I barged ahead myself. As you discover, asynchronous data calls force you through a lot of hoops (and loops!) to achieve cascading deletes. The foreign key constraints are what get you.

I suppose I could have taken the nice, easy route and assumed that the user could implement a SQL stored procedure to handle the chore. However, as Tina Turner announced in Proud Mary, "You see, we never ever do nothing nice and easy. We always do it nice and rough."

Episode 5: "D" is for Delete probes data associations, properties and links in the Entity Framework. It takes you step by step through the code to delete a customer, the customer's orders, and the order details. I hope you find it worthwhile.

Make sure you've worked through Episode 1, Episode 2, Episode 3, and Episode 4 first. Without them, you won't have the prerequisite code or project infrastructure to succeed in this episode.


 

Silverlight 2 Data Form - Episode 4: 'U' is for Update

Here's Episode 4 of my series on creating a Silverlight 2 Data Form in Visual Basic.

'U is for Update' takes you through validating user input, handling button clicks, saving data changes back to the database, and canceling changes. The screencast shows how to use the PropertyChanged event with more examples of wedging your own code into generated partial classes.

For best results, you really need to follow the previous screencasts (Episode 1, Episode2, and Episode 3) before trying this episode.

BTW, this series on CRUD operations in Silverlight has been immensely popular, with over 1500 viewings of Episode 1 in its first four days. Thank goodness for free Silverlight Streaming!

Ken

 

Silverlight 2 Data Form - Episode 3: Master/Details and ObservableCollection

In Episode 3 of my series on creating a Silverlight 2 Data Form, we display the details of the selected item and explore the DataContext property. I spend some time on the interesting and flexible ObservableCollection objects and configure automatic UI updating by implementing INotifyPropertyChanged.

Remember: These tutorials are sequential! You must complete Episode 1 and Episode 2 to be ready for this one. 

 

Learning CRUD and Data Forms in Silverlight 2 (Screencasts)

Not much stuck with me from years of Latin in high school, but the motto “Docendo discimus” has always served me well. “We learn by teaching” expresses one of my motivations for writing tutorials and creating presentations on the latest Microsoft technologies. The best way for me to grasp Silverlight 2 was to commit to an article or talk and then jump in head first to start figuring it out.

The ‘sink or swim’ approach leads to another observation: when a product is new, and documentation is sparse, what you need to know before you can do something, you learn by doing it. In other words, you muddle through and end up with valuable knowledge that you can share.

I was fascinated by the possibility of using Silverlight 2 as an alternative to ASP.NET business applications. The examples I found were either incomplete (didn’t actually save data) or over-engineered to be incomprehensible (by me, at least). So, I decided to build my own prototype and offer my learnings up as a series of screencasts.
 
The demo project is a small, but realistic example of how to create a CRUD (Create, Read, Update, Delete) application against the familiar Northwind database. It uses the latest stuff from Microsoft including Windows Communication Foundation, ADO.NET Data Services (Astoria), and the Entity Framework. 

Note to language bigots: I wrote the sample and screencasts in Visual Basic.  There were several reasons: I’m more comfortable in VB (although I write lots of C#); there’s a dearth of sample Silverlight code in VB; and people who write only in C# don’t need beginner-level content because they already know everything. <grin>
 
I'm sure people will report more "correct", elegant, and efficient ways to create the application, and that's fine by me. The goal is to learn Silverlight 2 data handling, and I'm still learning too. I expect to add an episode on fixing the bugs. <grin>

I've put the first two episodes online today, using Microsoft's wonderful free Silverlight Streaming as the host. The remainder of the screencasts (probably a total of eight) will appear by the end of next week.
 
Here are the first two episodes:
 
Silverlight 2 Data Form - Episode 1
Silverlight 2 Data Form - Episode 2

You'll need these resources to follow along with the screencasts.

I hope you’ll profit from my adventure and judge for yourself whether Silverlight 2 is ready for a business application. I’ll be interested to hear your thoughts as feedback in the series' forum.

WcfDataSource and AstoriaDataSource Controls Coming

The guys at Intersoft Solutions are working hard on some interesting products for creating business applications in Silverlight 2. Among them are datasource controls for Silverlight 2, something that is sorely lacking in the Microsoft release.

If you've found retrieving and binding to data a royal pita, you'll be interested in the XmlDataSource, WcfDataSource, and AstoriaDataSource controls they're planning to release this year.

 Here's a bit about the ADO.NET Data Services support:

"When using AstoriaDataSource as the datasource control, our upcoming Silverlight databound controls will perform data operations automatically, such as data selecting, data paging, data transactions (Insert, Update, Delete) as well as data manipulations (sorting, filtering)."

Ken

More Posts

Search

Go

This Blog

Web Links

Syndication