Silverlight 2 Beta1 + WCF + LINQ to SQL = a powerfull combination

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.

Comments (29)

  1. Techniques says:

    Over at the Swiss MSDN Team Blog, there is an excellent Silverlight tutorial video called " Silverlight

  2. BenHayat says:


    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!

    Thank you!


  3. BenHayat says:

    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?


  4. ronnies says:

    Hi Ben

    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.




  5. davidjjon77 says:

    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.

    David Roh

  6. BenHayat says:

    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!


  7. ronnies says:

    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.



  8. Blogs says:

    Here is the latest in my link-listing series .  Also check out my ASP.NET Tips, Tricks and Tutorials

  9. FlyingFishStix says:

    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 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"  🙂

  10. Hot Topics says:

    Scott Guthrie lists a number of posts and videos about the Silverlight 2.0 DataGrid in March 28th Links

  11. I’ll be using this page to link to Silverlight 2 articles and posts (both ones I write as well ones by

  12. In this 30 minutes video blog I will show you one approach on how to do insert, update and delete operations

  13. Post: Approved at: Apr-6-2008 Display/Edit data – SL2.0B + WCF + LINQ to SQL Here are a couple videos

  14. hoodg says:

    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?

  15. cschep says:

    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?

  16. In this 15 minutes video blog I will show you how you can scroll through large resultsets using the SL

  17. En un artículo de introducción al control DataGrid publicado anteriormente, vimos que para rellenar de

  18. You might have noticed that posts have dropped off over the last month or so.&#160; The reason being

  19. Since Silverlight 2 is in Beta 2 phase it’s definately time to create small application with it. Together

  20. Coding4Fun says:

    In this article, I will discuss how I have built RetroCommand, a Silverlight 2.0 Beta version of a classic

  21. Anonymous says:

    Over at the Swiss MSDN Blog, Ronnie Saurenmann has posted some really great tutorials for using Silverlight with a SQL database over a webservice and also includes how to do things like CRUD operations and how to implement your own client side change

  22. Based on the questions I received in the last period, I’d like to share here some links that will eventually

  23. (以下内容全部整理自博客堂Scottgu博客中文版)Silverlight技巧,诀窍,教程和链接 【原文地址】SilverlightTips,Tricks,…

  24. Valium ekg. says:

    Buy valium c.o.d.. Valium toxicity canine. Abusing valium. Valium liquid form. Valium.

  25. Zolpidem tartrate. Zolpidem with alcohol. Zolpidem.

  26. Dabas says:

    This video is very instructive!

    Unfortunately Silverlight does not have a dropdown control.

    How would this sample be rewritten to have the TextBox replaced by an HTML dropdown in the web application solution, probably also the Query button moved there, and then calling silverlight to show the datagrid?

  27. truejob says:




  28. Julien Lemarié says:

    If I want to have in my datagrid an information which is stored in an other table, how I can make that ?

    For example, I want display in the datagrid all my invoices with the name of client for each row.

    I need to create an object which contains the joint of 2 tables and binding the datagrid with this object ?


  29. Manoj says:

    I need to download this video? But in my browser it is not opening… will anyone can give me other link?