Video: Using LINQ with ASP.NET in VS "Orcas" (Part 1)

One of my goals this year is to use video more with my blog.  My theory is that video is often a better medium than text to walkthrough how something works, and can also help you avoid the tedium of reading though some of my really long blog posts... :-)

Over the next few months I'm going to try and create a new video every other week or so on various topics.  Many of these videos are going to involve first looks at some of the new features coming with Visual Studio "Orcas", which is our new release that will ship later this year.  For today's video I decided to focus on introducing LINQ - which I think is one of the most exciting features coming with "Orcas". 

At a high-level, LINQ makes the concept of query a first class programming concept within .NET.  Using LINQ you can easily query relational databases, XML files, as well as any plain-old .NET object.  You can also easily use your own data source abstractions with LINQ to provide rich domain models for various data providers (for a great example of this check out Fabrice's LINQ to Amazon implementation that supports LINQ queries against Amazon data exposed via web-services).  Both VB and C# include rich language integration with LINQ as part of the "Orcas" release, including full intellisense, compile-time checking, and debugging support.

Watch or Download the Video

This first video starts with a new project, and then demonstrates the basics of using LINQ against a SQL Database to build a simple data reporting page (including support for aggregate values computed from multiple tables, and efficient server-side paging within the database). 

You can watch the video online here (it is 24 minutes in length).  Or you can download a .zip version of it here if you want to save and watch it locally.  Note that it might take 30-60 seconds to buffer (since it is a large video).  In the event that my server is swamped with requests, I'll update the location and post it on one of the Microsoft video servers later this week.

For more information on LINQ (including the slide deck for a "Building ASP.NET Data Driven Application Using LINQ" talk of mine), please check out my previous post here.  For other ASP.NET 2.0 Tips, Tricks and Tutorials please check out my ASP.NET Tips and Tricks summary listing page.

Specifics Topics Covered in this Video

My walkthrough in this video illustrates a number of new features:

1) A brief demonstration of some of the new WYSIWYG HTML designer capabilities (including split-view and a brief look at the new CSS manager - both of which I'll cover in more detail in the future in a separate video):

2) How to create classes that model data using the new VS "Orcas" ORM designer for LINQ to SQL:

3) How to use the new LINQ intellisense support within the VS "Orcas" code editor to get full intellisense and compilation support for queries:

4) How to use LINQ to SQL to create a data report that combines Product entity data with aggregate unit and revenue values computed from OrderDetail entities associated with the Product entities.  This data report uses server side database paging to efficiently retrieve only 10 rows of data at a time (so that with a 100,000 row products table you only ever retrieve 10 rows of data from the database regardless of which page index you are on within a report):

Future Videos

I'll be drilling into LINQ some more with future videos (I barely scratched the surface with this one).  Additional segments will include content on:

  • Type inference and the "var" keyword (and why that is so cool)
  • Supporting Insert, Update and Deletes scenarios using LINQ to SQL
  • Validation rules and logic within LINQ Data Models
  • Using SPROCs with LINQ to SQL
  • Richer JOIN support with LINQ to SQL
  • LINQ to XML and LINQ to Objects
  • Using the new LINQDataSource controls and other ASP.NET Data Controls to easily create Web UI with LINQ

I'll also obviously have many more ASP.NET and web-related video topics to cover including:

  • The new HTML WYSIWYG Designer and CSS support
  • Client-JavaScript Intellisense
  • JavaScript Debugging
  • ASP.NET AJAX Extender Support
  • Database Dump and Upload Integration
  • Unit Testing
  • Multi-targeting support (showing how you can use VS "Orcas" to build ASP.NET 2.0 projects - without having to upgrade your framework/server)

Hope this helps,


P.S. If you have other topics and/or subjects you'd like me to drill in on with videos, please post them in the comments section of this post.


  • Great plan to post videos. Also, its great that "Orcas" would come out with a future version of ASP.NET (v3.0?) which doesnt involve separate downloads for implementing Ajax. Many people already use the term ASP.NET 3.0 since .NET Framework 3.0 release(since the earlier releases of .NET Framework had an equivalent ASP.NET Version)

  • wow, so many vidoes for orcus and that too by scott.

  • I have been reading your blogs for almost a year now. Now, it is really nice to see you putting up videos. I totally agree with you that it makes our lives even simpler.
    Thanks…looking for your future videos.

  • Can you explain why someone would bother with LINQ if they are already good in SQL and have an existing process to quickly create and manage stored procs?

  • Thanks a bunch bro.
    You're providing services that loyal fans of Microsoft products like us have always "wished" for. Salute! (With honors!)

  • Thanks for posting this, Scott. You are correct, video is just the better way to go. If a picture is 1000 words....

    I'm really enjoying the trend I see happening where database support is more and more an extension of a framework and its language as opposed to it being a totally separate entity needing drivers, connectors, and special classes. Looks to me like LINQ is a step in the right direction.

  • Excellent idea to start using video. I'll probably start bundling some of these up as lunchtime presentations for my development group. Thanks!

  • Hey Scott, thanks for all you work on this! Could you provide some insight into the differences and integrations between "Linq to Entity" from ADO 3.5 and "Linq to SQL" and whether they will sharing a single code base, etc.


  • Thanks for the video. Though I would be interested to see how you would fully implement paging functionality in your example. To do so, I guess, you will need to get somehow total amount of rows regardless of which part/page in result set you're actually retrieving from Db.

  • Scott,

    What version of the CTP's are you using for the demos? I didn't see this info in the blog post text. It would be helpful to know which version you are using so that we could set our expectations accordingly.


  • One more question. I see you dragged some tables to a visual designer for the mapping. Why is that step necessary? If you just point to the database it could pick up the tables and relations right?

  • Great are making life simple for us..... now even a cave man can learn .NET Easily...:)

    BTW, the server might be hosed with requests. can you post the other link you wer talking about?.


  • I have to disagree with the Video Fans.

    I can extract the information I need from a page of text much quicker than I can a video presentation so consequently it's unlikely I'll get around to watching any / many of your videos :-(

  • Hi Scott,

    I noticed that you are working in Windows XP on the video. Is Orcas currently working full-featured in Vista?

    I recently upgraded to Vista and had some painful moments trying to get my development environment working again. (It's still much slower and "shakey" than it was in XP.) I am hopeful that the Vista support will be all there for the next releases.

    Comments on this subject would be appreciated.


  • Hey Scott,

    We (where I work) are starting to play around with Vista/IIS 7 as development platforms and I was wondering if you could do more posts on the many types of config permutations available with IIS 7.

    One in particular we are having some trouble with is running forms authentication for ASP Classic pages in the Classic managed pipeline mode.

    Another might be a walkthrough on getting ASP.NET AJAX RTM workin in IIS 7 (web.config setup etc...)


  • Great video to learn Linq. Is it possible to do the same thing in design time rather than in runtime because most of the times many would prefer to do the databinding of the controls in designtime as it would ease the formatting stuff.

    Also I would like to see some WPF\E videos that explains WPF\E controls integration with the serverside as well as ASP.Net AJAX.

    Also you have mentioned that Orcas will be released later this year. Will the existing ASP.Net 2.0 code will work in orcas without any modification\migration kind of a thing.


  • Nice Video. Anybody know when is Orcas going to release? Can't wait to upgrade myself to the new technology.

  • Hi pb,

    I'll be posting some samples showing how to use Stored Procedures with LINQ. I think you'll find that it works pretty cleanly, and enables a nice object oriented way to work with data via them.

    Stay tuned for samples...


  • Hi Matt,

    I'll try and do some IIS7 videos and posts as well. :-)



  • Hi Ponnu,

    You can use LINQ programmatically - we also will have data control support that makes it easy to databind it declaratively (no code required).

    Orcas will ship later this year, and will not require any code updates to existing ASP.NET 2.0 code (all existing code will just work).



  • Hi Sahil,

    Yep - I'll definitely include videos on updating/inserting data. The support within LINQ for this is pretty sweet (and we'll have a nice LINQDataSource control that makes integrating it with web UI a snap).



  • Hi Sahil,

    Yep - I'll definitely include videos on updating/inserting data. The support within LINQ for this is pretty sweet (and we'll have a nice LINQDataSource control that makes integrating it with web UI a snap).



  • Hi Todd,

    Can you send me an email about the issues you were seeing with Vista? I can then have someone help investigate to figure out what is going on.

    I actually use Vista for my dev environment and really like it (I haven't had any problems with it). VS Orcas is fully supported on Vista - it was just that the VPC image that a picked up that already have VS Orcas installed was using Windows Server 2003, which is why it was using that for the video.

    Hope this helps,


  • Hi WillC,

    LINQ to SQL and LINQ to Entities will support the same LINQ syntax for queries, but support different ways to model the entities that you query and interact with. LINQ to SQL uses a logical view of your data that maps closer to the underlying database, while LINQ to Entities provides a conceptual model mapping mode that allows you to model your entities in some cases quite different from the underlying database (which is useful in a lot of enterprise scenarios where you are sometimes forced to work with schema that isn't always flexible at the database level).

    Hope this helps,


  • Hi Scott,

    I was using a recent build of VS Orcas for this video. It has a number of features that weren't in the January Orcas CTP. The February CTP will have all of the features I demoed.

    Hope this helps,


  • Hi Mike,

    Can you try watching my video in full screen mode? I think you might be seeing some fuzzies because you are running the video in lower resolution than its native 1024x768 mode.



  • Sounds great that LINQ has a provider model. Very pleased to hear that.
    Is there some info avaliable on this somewhere?

    On the subject providers, will current ASP.NET 2.0 providers, such as Membership, be extended in ASP.NET 3.0 to provide new functionality?

  • If I have an exisiting Data Layer written with ADO.NET what does LINQ provide for me?

    Can I continue coding in ADO.NET or will LINQ take over?

    IMO, I don't find the LINQ syntax that easy to read - I guess I've become acclimated to ADO.NET & SQL code.

  • Scott,

    Great vid demo on the new features of LINQ to SQL and VS Orcas. I am really looking forward to learning and using these tools as a career web developer. Can't wait to see the next demos!

  • It appears the CPTs are coming out in VMs, will the Feb release be installable (no need for VM) or just in VM? Also, if in VM, is that able to be run under Vista 64?

  • Hi Scott,

    Does the DLINK to SQL translation system allow for caching of the generated SQL code (perhaps right on the DB)? This way one might save some cpu cycles and close the db connection more quickly, getting perhaps even near T-SQL performance?



  • Video demos are like peering over the shoulder of an enthusiastic explainer. Or attending a cozy presentation on one focused topic with refinements of the simple example that reaally take the technology out for a spin.

    And along the way, we see new features (apply CSS, splitview).

    You really covered the underlying questions ('we have SQL sprocs, why do we need a new way of querying??' IntelliSense, same syntax for db, xml, objs.)

    Thanks for posting these videos. Looking forward to the upcoming ones. Great stuff.

  • Scott,

    In the video, I noticed that there was a server icon named "Manage Your Server" located near the top of the start menu. What kind of app is that?

    Thank you,


  • A huge time saver for Orcas would be -

    Use the arrow keys to move, by a pixel, controls around Design View

  • Hi Jim,

    I was actually using Windows Server 2003 in the VPC image (it was using the XP theme). Windows Server is what has the "manage your server" functionality.

    Hope this helps,


  • Hi Rocky,

    I believe the CTPs going forward will move to have both VM images as well as standalone setup ones for existing OS installations.

    Hope this helps,


  • Hi Mads,

    I believe the provider model is still being finalized right now, so I'm not 100% sure if it is publically documented yet (if it is it would be in the ADO.NET vnext August CTP).

    One LINQ is available, I definitely expect some new providers to materialize (either written by us or someone else) who integrates the ASP.NET providers with them.

    Hope this helps,


  • Great video, very clear, thanks!

  • Hi xingfang,

    The demo I showed above is using a build that is later than the January CTP. The features within it will show up in the Feb CTP in a few weeks to download.



  • Sahil: Yes, Skip support in Sql2k is sub-optimal (or broken, depending on your point of view), due to limitations in what Sql2k can provide. There's really very little that can be done to improve matters, unfortunately.

    Having ROW_NUMBER() available in Sql2k5 really made Skip possible (if not somewhat fun to implement).

    ScottGu: Having spent my pre-Microsoft daze wrestling with databinding and page lifecycle quirks, the DataSource controls were one of the best features I saw come out of Whidbey: you have no idea (unless you ask around) how pleased I am to hear that a LinqDataSource is planned.

    -- kfarmer (LINQ to SQL)

  • Hi Scott,

    I notice that only a subset of the columns/properties of Product are displayed in the grid, before you actually specify which columns you want using an anonymous type. How comes? What's the mechanism that decides which columns are visible?


    PS: Thanks for the link :-)

  • Earlier today I downloaded the latest release of LINQ. I have created a web site project based on the "LINQ ASP.Net Web Site Template".

    I then decided to use the "Linq to SQL File" through Add New Item and the "Linq to SQL File" does not exist as an option. Any clue as to why?

  • Hi Demetri,

    The "LINQ To SQL" support isn't available in the January CTP of "Orcas". It will show up in the February CTP though - which will come out in a few weeks.



  • Video URL is broken....Do you have a new location do download it ?

  • Hi Alexnaldo,

    The DNS server that serves my site went down today, but should be back up in a few hours. Once it is the link will work again.



  • Yes!!!!!!!!!! Finally, Microsoft has embaced Object Oriented Mapping!!!!

  • I want to get video using linq with in vs "orcas"
    best regards

  • I am really keen to see how validation and concurrency works with Linq. You mentioned in this blog you were going to do more and one was to include validation. Do you have any links to sample validation and or concurrency examples of linq to sql.
    Thanks in advance

Comments have been disabled for this content.