Attention: We are retiring the ASP.NET Community Blogs. Learn more >

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.


 

1 Comment

Comments have been disabled for this content.