In this 15 minutes video blog I will show to you how to use the combined power of Silverlight, WCF and LINQ to SQL to create a simple application.
double click the player to play in fullscreen
Attached you can find the final solution.
Over at the Swiss MSDN Team Blog, there is an excellent Silverlight tutorial video called " Silverlight
I have one very important question:
You have added the LINQtoSQL model and WCF service and SL project all in the same solution and you made the reference in SL to see the WCF service. When the SL runs on your machine, you machine is acting as a client for SL and a server for the service and SL can find that service with no problem.
My question is, how do you develop that same application to be deployed in real life, where the SL client and WCF are on different machines and SL client can easily talk to remote WCF service.
Secondly, would the LINQtoSQL be part of the same WCF service project?
Thirdly, is the "London" filtering being done at client or at the server side?
I think this demo went too fast, for such a important topic!
Would it be possible to add another blog to show how a basic CRUD operation is done using the same technique as above to use LINQ but to send create a customer and send the capture data from SL to the data service?
In real life you would host the ASP.NET/WCF project in IIS and it works. You simply need to change the url of the service to use port 80 and the fully qualified domain name.
If you want to host the WCF on another domain than the one that you are receiving the SL binary you need to deploy on the WCF IIS server a policy file.
LINQ to SQL part (e.g the DataContex) should be better in another project for a better separation and reuse.
"London" filtering is done by the LINQ to SQL engine and physically done with in SQL Server itself. So you transfer only the London customers from the DB to the WCF to the SL layer.
Regarding CUD (read is easy) is a more challenging situation due to the lack of client side change tracking from LINQ to SQL. See my post on LINQ to SQL the good, the bad and the ugly. It is possible but it requires some coding in SL and in the WCF/LINQ layer.
I will try to show one way to do it hopefully in one of the upcoming video blog.
Very nice - just what I needed.
It would be great if we could download the video.
I agree - this is a very important subject that deserves a lot more detailed video and article.
Thank you very much for the source code.
Thank you Ciao for detail answers to my question. The last part (CUD) that you mentioned, you hit it right on the nail that for concurrency situations and change tracking can get complex between client, middle tier and database.
So, here is the next question. What you have said, I've already gone through researching and have come to conclusion that [presently, based on what I know so far], Astoria is my best bet to use as my middle tier data server for SL client [when it comes out]. Would you agree that I'm on the right path or is MSFT working on another custom middle tier solution that would help us work/use database?
I hope you can provide some info as to how MSFT is planning to solve this. I can't write a business app, until I have a solid solution for my middle tier. What's your advice?
Thank you Sir!
Stay tuned and I will post a video blog in the next weeks how to use LINQ to SQL with optimistic locking and SL. I will then later compare it to Astoria.
Here is the latest in my link-listing series .  Also check out my ASP.NET Tips, Tricks and Tutorials
First of all, fantastic video. Nice and fast. You nailed the detail for GETTING data using wcf. So well done! But... that' only half the picture. In the real world - we desparately need to know how to use CRUD with Silverlight for our LOB apps or this bird ain't flying.
hey Ben, (re your comment above)
I fully agree. I've been pulling my hair out tring to figure out the best way to save back to a remote DB (n-tier) using Silverlight. Like you, I've been digging all over the web for answers and have also come to the same conclusion.
A) that no one really knows how to do it since I have yet to see ONE video on it (yes, that's a challenge to anyone), and
B) Unless shown otherwise, Astoria's data services ARE probably the answer for the middle-tier. (Although I hope I'm wrong.) Note: Pablo posted on his astoria.mslivelabs.com site that some ctp might only be weeks away(?) <holding breath>
I got burned by Silverlight1's hype and I sure hope Silverlight2 addresses this. I'm still trying to sort out hype from reality.
I think Silverlight2 could truly be a tidal wave all over the web, but it's going nowhere fast if we don' know how to do n-tier CRUD the Silverlight way. We need this exact type of video re: saving data. I don't care how complex it is.
Thanks..eagerly waiting for "part2" :)
Scott Guthrie lists a number of posts and videos about the Silverlight 2.0 DataGrid in March 28th Links
I'll be using this page to link to Silverlight 2 articles and posts (both ones I write as well ones by
In this 30 minutes video blog I will show you one approach on how to do insert, update and delete operations
Post: Approved at: Apr-6-2008 Display/Edit data - SL2.0B + WCF + LINQ to SQL Here are a couple videos
I followed along with everything, but cannot load the VS project in Blend 2.5 - get "prject file ... not supported" error.
I also cannot seem to use the Silverlight designer in VS - can't drag controls onto the design surface.
Any idea what I might be missing?
Hi there. I followed the tutorial and everything works just fine. I decided I wanted to add another function to Service1.svc.cs. SO, I put the prototype in IService1.cs and implemented it.
For some reason the new function won't show up in the service in my silverlight app, even after removing the service, and re-adding it. What am I doing wrong? Any Ideas?