Monthly Archives: July 2007

YSlow Helps You Speed up your web pages

Yahoo! released an excellent performance utility on YDN called YSlow, to help you understand why your pages are slow. YSlow is a Firebug addon. It provides different views to analyze your pages : yslow perfview thumb YSlow Helps You Speed up your web pages
  • Performance View: YSlow analyzes any web page and generates a grade for each rule and an overall grade. If a page can be improved, YSlow lists the specific changes to be made.
  • Stats View: YSlow calculates the total size of the web page for both empty cache and primed cache scenarios, as well as information about cookies.
  • Components View : YSlow lists all the components in the page including their type, URL, Expires date, gzip status, load time, size, and ETag. You can also view the HTTP response headers for any component.

Yahoo!’s Exceptional Performance team have a great reference with best practices for improving web performance, including rules and research papers. Be sure to check it out.

VS 2008 and .NET 3.5 Beta 2 Released

I have been away for 10 days and during that time the new VS 2008 and .NET 3.5 Beta2. Here is what Scott Guthrie writes about this news:
You can download the Visual Studio 2008 product here. You can alternatively download the smaller VS 2008 Express Editions here.

VS 2008 and Visual Web Developer 2008 Express can be installed side-by-side with VS 2005. .NET 3.5 Beta2 also includes a go-live license which allows you to build and deploy applications into production.

Very Important: Please read my “Installation Notes” at the bottom of this blog post for a few post-installation steps you must make to ensure everything runs well. One of these steps fixes a side-by-side issue we found with ASP.NET AJAX.


Quick Tour of Some of the New Features for Web Development

Over the last few months I’ve written several blog posts that discuss some of the new improvements in this release. Below is a quick summary list of several of them that I have already published. This list is by no means exhaustive – there are a lot more things I haven’t had a chance to blog about yet (stay tuned for more posts!):

VS 2008 Multi-Targeting Support

VS 2008 enables you to build applications that target multiple versions of the .NET Framework. You can learn more about how this works from my blog post here:

VS 2008 Web Designer and CSS Support

VS 2008 includes a significantly improved HTML web designer. This delivers support for split-view editing, nested master pages, and great CSS integration. Below are two articles I’ve written that discuss this more:

ASP.NET also has a new control that I’ll be blogging about in the near future. It delivers very flexible support for data UI scenarios, and allows full customization of the markup emitted. It works nicely with the new CSS support in VS 2008.

ASP.NET AJAX and JavaScript Support

.NET 3.5 has ASP.NET AJAX built-in (and adds new features like UpdatePanel support with WebParts, WCF support for JSON, and a number of bug fixes and performance improvements). VS 2008 also has great support for integrating JavaScript and AJAX into your applications:

I will be doing a blog post in the next few days that talks more about some of the ASP.NET AJAX specific improvements, as well as how to upgrade existing ASP.NET AJAX 1.0 applications to use them.

Language Improvements and LINQ

The new VB and C# compilers in VS 2008 deliver significant improvements to the languages. Both add functional programming concepts that enable you to write cleaner, terser, and more expressive code. These features also enable a new programming model we call LINQ (language integrated query) that makes querying and working with data a first-class programming concept with .NET.

Below are some of the articles I’ve written that explore these new language features using C#:

Data Access Improvements with LINQ to SQL

LINQ to SQL is a built-in OR/M (object relational mapper) in .NET 3.5. It enables you to model relational databases using a .NET object model. You can then query the database using LINQ, as well as update/insert/delete data from it. LINQ to SQL fully supports transactions, views, and stored procedures. It also provides an easy way to integrate business logic and validation rules into your data model. Below are some of the articles I’ve written that explore how to use it:

I’ll be adding several more articles to my series above in the weeks ahead. I think you’ll find that LINQ to SQL makes it dramatically easier to build much cleaner data models, and write much cleaner data code.

Lots of other improvements

The list above is only a small set of the improvements coming. For client development VS 2008 includes WPF designer and project support. ClickOnce and WPF XBAPs now work with FireFox. WinForms and WPF projects can also now use the ASP.NET Application Services (Membership, Roles, Profile) for roaming user data. Office development is much richer – including support for integrating with the Office 2007 ribbon. WCF and Workflow projects and designers are included in VS 2008. Unit testing support is now much faster and included in VS Professional (and no longer just VSTS). Continuous Integration support is now built-in with TFS. AJAX web testing (unit and load) is now supported in the VS Test SKU. And there is much, much more…


Important Installation Notes – PLEASE READ!

There are two important things you should do immediately after installing VS 2008 and .NET 3.5 Beta2:

1) You should download and run this batch file. This takes only a few seconds to run, and fixes an issue we found earlier this week with the version policy of System.Web.Extensions.dll – which is the assembly that contains ASP.NET AJAX. If you don’t run this batch file, then existing ASP.NET 2.0 projects built with ASP.NET AJAX 1.0 and VS 2005 will end up automatically picking up the new version of ASP.NET AJAX that ships in .NET 3.5 Beta2. This will work and run fine – but cause you to inadvertently introduce a .NET 3.5 dependency in the applications you build with VS 2005. Running the batch file will change the version binding policy of the new System.Web.Extensions.dll assembly and ensure that you only use the new .NET 3.5 ASP.NET AJAX version with projects that you are explicitly building for .NET 3.5.

2) If you have ever installed a previous version of “Orcas” or VS 2008 on your machine (either Beta1 or one of the CTP versions), you need to reset your VS 2008 settings after installing Beta2. If you don’t do this, you’ll have an odd set of settings configured (some windows will be in the wrong place), and you’ll potentially see some IDE performance slowness. You can reset your settings by typing “DevEnv /resetsettings” on the command-line against the VS 2008 version of the IDE:

step1 VS 2008 and .NET 3.5 Beta 2 Released


Summary

There are a lot of new improvements and enhancements that I hope you’ll find really useful with VS 2008 and .NET 3.5. Stay tuned to my blog over the next few weeks as I’ll be posting more about some of the new features and how to get the most out of them.

Here is the original

VS 2008 JavaScript Debugging

Scott Guthrie writes about JavaScript Debugging into new VS 2008!
One of the other JavaScript features that I’m sure will be popular in VS 2008 is the much-improved support for JavaScript debugging. This is enabled in both the free Visual Web Developer 2008 Express edition as well as in Visual Studio, and makes using JavaScript and building AJAX applications significantly easier.

Check his post here

Intellisense in ASP.NET Orcas Beta 1

Found that post on Rick Strahl’s web log, over here he describes different situations in which JS Intellisense is and isnt working in new VS 2008. Check it out:

So I’m trying to understand what actually works and what doesn’t with Orcas JavaScript Intellisense. I’ve used Orcas for a bit now and unfortunately I’ve had little luck on getting Intellisense support with my non-MS AJAX libraries. My own libraries don’t work and neither does anything in Prototype, Scriptalicious or jQuery.

It appears that Orcas does fine with any straight function and variable definitions. If I have an ASPX page or a backing .js file and all I have in there is plain functions as is often the case with front end UI code I get Intellisense on this functionality.

The real issue has to do with class/object recognition. The problem there of course is that there are many, many different ways in JavaScript to define a ‘class’ (there really are no classes only closures that act like them ) and Orcas Intellisense only supports some of these formats.

So I set up a a sample JS file that checks for different class formats and how the Intellisense works for them. I created a simple ASPX page and added a reference to a script file. The comments indicate whether the structure is visible to Intellisense.

<script src="test.js" type="text/javascript"></script>

And then created the JS file with the following:

// this works finefunction HelloWorld(name){   alert("Hello " + name);

   return false;}

// Class as closure -  doesn't workfunction MyClass1(){   this.myProperty = "Test";   this.myProperty2 = 0;

   this.myMethod = function(input)   {       return 0;   }}

// JSON static Class syntax - worksvar MyStaticClass2 ={   myProperty: "Test",   myProperty2: 0,   myMethod: function()   {       return 0;   }      }

// Prototype syntax - worksfunction MyClass3(){}MyClass3.prototype ={   myProperty: "Test",   myProperty2: 2,   myMethod: function(num)   {       //         return 0;   }          }

// *** Additional Prototype assignments - worksMyClass3.prototype.myProperty3 = 3;

// *** Direct property assignment - doesn't workMyClass3.myProperty4 = 4;

I might be missing other ways here – if you see one of those leave a comment and I’ll add it here. It seems it would be good to know what does and doesn’t work.

read original

Visual Studio 2008 and ASP.NET 3.x

Rick Strahl is again sharing his thoughts about VS 2008 and the new ASP.NET 3.x, here is part of it:

I’ve been running Orcas quite a bit since Beta 1 was released in April and overall I’m pretty damn happy with this update to Visual Studio 2008. You may have noticed that I HAVEN’T posted a lot about Orcas issues and that’s because overall Visual Studio Orcas and the feature set is working rather well for me. Microsoft has really done a much, much better job this time around to provide a sane set of updates to the framework as well as what amounts to an incremental update in Visual Studio.

Visual Studio 2008 is interesting on several levels. First and I think this is very significant is that it works with .NET 2.0 and you can build applications that run on .NET 2.0. This means it’s possible to take advantage of many of the new features in Visual Studio – especially the new designer and the somewhat improved JavaScript support – even for today’s projects. That makes the new tool very palatable to try and play with immediately. I’ve moved several of my internal applications to Orcas and it’s been a pleasure working in VS 2008.

Second although there are some major changes in the editors, overall the Visual Studio shell isn’t completely changed. In fact, most of my add-ins, Intellisense scripts, templates etc. all work in Visual Studio 2008 which gives me my base toolset I work with and helps with productivity. I’m really glad that there wasn’t another complete overhaul of the system that required everything to be at least recompiled if not to be redesigned.

One of the biggest advantages in VS 2008 is the new HTML editor both for markup and design view. It’s based on the same editor that’s in Microsoft Web Expression (which is a great tool BTW and which I use daily!) and provides a ton of improved functionality and much better rendering. However, the biggest bonus that you’ll notice immediately with the new editor is that it is much, much faster than the VS 2005 editor. You know the feeling in VS 2005 as you open a markup or worse a designer page and you wait and wait and wait some more. With VS 2008 that is no longer the case – activating markup or design view happens in a second or two even for complex pages. Not only that but because there’s split view for design and markup you rarely switch views and because both panes stay in sync the whole experience is much more expressive. The editor and speed alone is a big productivity improvement at least for me.

That isn’t to say that that there aren’t problems with VS 2008. Yes some things are broken and Orcas will crash occasionally (although not any more than VS 2005) but overall the experience for a Beta 1 product is very good! Good enough to be productive with it.

ASP.NET 3.x

I’ve also spent a bit of time working with .NET 3.5 mostly for back end related framework stuff. There’s a lot of interesting stuff but most of the really cool features of .NET 3.5 are related to LINQ and the language enhancements in C# and VB.NET many of which are very useful productivity enhancers. I’ll post more on some of this in the coming weeks.

But what’s interesting is that there’s not a lot of new stuff for ASP.NET 3.5. In fact looking through the System.Web.Ui namespace with Reflector there’s only a couple of new controls – the ListView and DataPager. ListView is a new control that’s sort of a mix between a repeater and a GridView. It provides the rich templating of a Repeater combined with the grid’s advanced features like Paging, Sorting and Editing. It’s interesting but hardly something to jump up and down about. There’s also a LINQDataSource which makes it easy to create and consume LINQ data. That’s about all that I could find that was obvious. I spent a bit of time looking around trying to find more information on what’s new in ASP.NET but couldn’t really find anything else of note. It’s clear that the core of new features that will impact ASP.NET 3.5 are going to be related to the language enhancements and LINQ.

Disappointing? Not at all!

It’s important to remember that the ASP.NET team has already delivered very important support features prior to the Orcas release cycle. Specifically I’m thinking of ASP.NET AJAX and full support for the IIS 7 integrated pipeline, which in my opinion really counts as the ASP.NET 3.0! IIS 7 and the integrated pipeline opens up many new possibilities for deep Web server integration and it’s great to see that this whole new pipeline model was able to integrate with ASP.NET so seamlessly that as a developer you never actually know the difference.
read original

LINQ to SQL (Part 5 – Binding UI using the ASP:LinqDataSource Control)

Hi all, I have been quite busy lately so didnt got much time to post here, but now will try to catch it up. Here is a post from Scott Guthrie which is PART 5 of his LINQ to SQL series:

Over the last few weeks I’ve been writing a series of blog posts that cover LINQ to SQL. LINQ to SQL is a built-in O/RM (object relational mapper) that ships in the .NET Framework 3.5 release, and which enables you to easily model relational databases using .NET classes. You can use LINQ expressions to query the database with them, as well as update/insert/delete data.

Below are the first four parts of my LINQ to SQL series:

In these previous LINQ to SQL blog posts I focused on how you can programmatically use LINQ to SQL to easily query and update data within a database.

In today’s blog post I’ll cover the new control that is shipping as part of ASP.NET in the upcoming .NET 3.5 release. This control is a new datasource control for ASP.NET (like the ObjectDataSource and SQLDataSource controls that shipped with ASP.NET 2.0) which makes declaratively binding ASP.NET UI controls to LINQ to SQL data models super easy.


Sample Application We’ll be Building

The simple data editing web application I’ll walkthrough building in this tutorial is a basic data entry/manipulation front-end for products within a database:

step03 LINQ to SQL (Part 5   Binding UI using the ASP:LinqDataSource Control)

The application will support the following end-user features:

  1. Allow users to filter the products by category
  2. Allow users to sort the product listing by clicking on a column header (Name, Price, Units In Stock, etc)
  3. Allow users to skip/page over multiple product listings (10 products per page)
  4. Allow users to edit and update any of the product details in-line on the page
  5. Allow users to delete products from the list

The web application will be implemented with a clean object-oriented data model built using the LINQ to SQL ORM.

All of the business rules and business validation logic will be implemented in our data model tier – and not within the UI tier or in any of the UI pages. This will ensure that: 1) a consistent set of business rules are used everywhere within the application, 2) we write less code and don’t repeat ourselves, and 3) we can easily modify/adapt our business rules at a later date and not have to update them in dozens of different places across our application.

We will also take advantage of the built-in paging/sorting support within LINQ to SQL to ensure that features like the product listing paging/sorting are performed not in the middle-tier, but rather in the database (meaning only 10 products are retrieved from the database at any given time – we are not retrieving thousands of rows and doing the sorting/paging within the web-server).

read original

VS 2008 Nested Master Page Support

Scott Guthrie describes this new feature in Visual Studio 2008. Looks nice, cant wait to see it in action. Here is the beginning of his post:

“Master Page” support was one of the most popular features introduced with ASP.NET 2.0, and is one of those features that almost every new ASP.NET project now uses to deliver consistent layout template support across a web site.

One of the cooler scenarios that ASP.NET 2.0 supports is the ability to have “nested master pages” – where you can create a root master page for a site that defines a site’s overall layout, and then create nested master pages that are based on the root master and further customize the layout (for example: you could create a SingleColumn.Master and TwoColumn.Master that defined 1 or 2 column layout structures based on the root master template). This nested master page feature is extremely flexible, and enables developers and designers to quickly and very cleanly make changes to the layout and organization of a site with minimal code changes and no content duplication. The one (big) catch, though, is that Visual Studio 2005 doesn’t really support using nested master pages, and pages based on nested masters can’t be edited within the VS 2005 WYSIWYG designer.

The good news is that VS 2008 fully supports nested master pages, and makes using them super easy. Going forward I recommend that almost all ASP.NET projects should advantage of this feature – since it can add tremendous flexibility to the UI of your projects.

Using Nested Master Pages With VS 2008

One of the sites I recommend checking out is http://www.opensourcetemplates.org/. This is an online repository of free HTML site templates that you can browse, download and use. The templates on the site are pure HTML (meaning you can use them with any server-side programming technology), and are built using clean CSS and XHTML markup:


read original

ASP.NET, ASP.NET AJAX, Visual Studio, Silverlight and IIS7

This is last list published by Scott, in which he presents latest articles and posts relating ASP.NET, ASP.NET AJAX, Visual Studio, Silverlight and IIS7. Check it out here, at the bottom is a link to the original:

ASP.NET

  • ASP.NET RSSToolkit 2.0 Released: One of the cool projects for ASP.NET 2.0 that was released last year was this free RSS Toolkit – which makes consuming and exposing RSS feeds in ASP.NET super easy (you can even databind any ASP.NET control against them). The team working on the CodePlex project has recently released V2 of the RSSToolkit. You can learn all about it and download it here.

  • Building a Custom Database Driven Site Map Provider: Scott Mitchell has written a great article on how to implement your own site map provider for ASP.NET that is populated from a database (instead of statically from an XML file). You can learn more about the ASP.NET 2.0 SiteMap system from this older blog post of mine here.

  • .NET DateTime and Number Format String Cheat Sheet: If you are like me, you might have trouble remembering all of the standard format strings you can pass to the String.Format() method and/or the Eval() databinding method in ASP.NET to generate the appropriate string output from a DateTime or Numeric datatype. This PDF cheatsheet is a useful one to download and save to quickly look these format strings up. John has some other really useful .NET PDF cheatsheets he has also created that you might like to download here.

  • Profile Support for ASP.NET Web Application Projects: VS 2005 Web Application Projects can’t directly access the strongly-typed ASP.NET “Profile” object that web site projects support. This VS add-in supports the ability to generate a strongly typed profile class to accomplish this. You can read this great series of posts to learn more about how to use the ASP.NET 2.0 Profile system. I have it on my list of tips/tricks posts to-do to cover using this VS add-on as well.

  • ASP.NET Photo Handler: Bertrand has posted a cool photo album HttpHandler for ASP.NET that allows you to easily drop images into a web directory and automatically generate a nice photo album of them (complete with EXIF information, stack sorting icons, etc). Might be very useful for people enjoying holidays this summer. Download the code here.

  • BlogEngine.NET: This is a new open source blog engine for ASP.NET that Mads Kristensen has helped start up, and which I’ve heard a lot of good things about. You can read about its features here, and download it here.


ASP.NET AJAX

  • ScriptDoc 1.0 Available: Bertrand Le Roy has published a cool ScriptDoc utility that extracts documentation from JavaScript files and packages it into XML that can be consumed by documentation building tools. A very useful tool as you start to build up your own JavaScript libraries.


Visual Studio

  • GhostDoc 2.1.1 Released: GhostDoc is a free add-in for Visual Studio 2005 (and now 2008) that automatically generates default XML documentation comments for code you write in C# or VB. It can automatically re-use existing documentation inherited from base classes or implemented interfaces, or generate initial documentation by deducing comments from the name and type of the member signature. You can learn more about it and download it for free here.


Silverlight

  • Silverlight Tutorials: Michael Schwarz has a great blog where he writes regularly about Silverlight. This tutorials link points to a bunch of great Silverlight content.


IIS 7

  • IIS 7.0 is now running all of Microsoft.com: One of the things we push at Microsoft is to “dogfood” our products on our high volume sites when they enter the beta cycle. As of a few weeks ago, all of the web servers running www.microsoft.com are now running on IIS7 and Windows 2008 Server Beta3. These servers host 500+ virtual roots and 350 ASP.NET applications, and handle 300,000 concurrent connections. IIS7 is going to be an awesome release.

  • IIS 7.0 on Server Core: Bill Staples blogs about some of the new IIS7 enhancements that appear with the June CTP of Windows 2008 Server. One of the big features that is now supported is the ability to install IIS7 on “server core” – which is a low footprint installation of Windows 2008 Server that lays down just the minimal footprint needed to boot (meaning no GUI shell). This lowers the resources required on servers, and even more importantly means that servers don’t need to be updated if a patch is released for a component not installed on the server (which lowers the downtime of servers). ASP.NET and the .NET Framework aren’t supported yet in server core configurations – but will be in the future.

read original

Dojo 0.9 lands softly

logo Dojo 0.9 lands softly
Can’t miss that one also, few days ago the guys from Dojo Foundation released new version. Check out their post here:
The Dojo Foundation is proud to release version 0.9beta of The Dojo Toolkit. Though still in Beta, 0.9 is a better, faster, and more cohesive way to incrementally upgrade the Open Web and make your applications shine.

The Toolkit has undergone a massive transition: countless numbers of community man-hours, seemingly endless questioning of sacred cows and assumptions, and hard work towards a unified goal have gone into producing this milestone release. There are warts in this beta, and you can help us even them out by filing patches and bugs, add comments and content to the Porting Guide, and start pushing the components to the edge.

While the 0.4.x branch helped us build great applications and learn a lot, 0.9 is a fresh start. Over the next couple of weeks we’ll be talking more about what decisions went into 0.9 and why we feel it’s the best Dojo ever, but some points bear emphasis:

SPEED: Stripped of all ‘excessive’, redundant, and backwards-compatible code, the new Dojo core is a speed-demon. It consists of a streamlined, compact Base (aka: dojo.js) which provides a plethora of reliable features for you and your application to expand upon. Our goal was to keep the new Base under 50K on disk and we’re happy to say that even with the many improvements to it since M2, Dojo Base still clocks in under the wire and gzipped it’s even smaller: 24K. The base of the new widget system (dijit.js) is even lighter, weighing in at 21K on disk and 11K on the wire.

Accessibility: one of the main goals of Dojo’s 1.0 release is accessibility. We want to put the power to build great web applications in everyone’s hands, and that means applications that are also great for everyone. Dijit (the dojo widget system) is striving to make all aspects of the Dojo Toolkit accessible via keyboard navigation, accommodate screen readers, and work in high-contrast mode for visually impared users, while still maintaining its elegant and customizable structure. Much of that work is already done as of Beta and it shows. Try tabbing around the examples on IE or FF and you’ll see how a focus on a11y makes the components we provide better. Again, our heartfelt thanks to Mozilla and IBM as well as David, Simon and Becka11y (the a11y team) for their continued efforts on everyone’s behalf.

Theming: Dijit is entirely customizable. Shipping with a default theme named ‘Tundra’, a structure has been established with which to create your own personalized sytle of Dojo, on a per-page or per-node or per-widget basis. All dijit look and feel is CSS-based, and easily extendable. Look at any of the Dijit examples and you’ll see that there’s no magic about how the CSS gets loaded or applied. Want to provide your own theme? Just create an allegory to tundra.css and you’re off to the races!

Documentation: a new version of our venerable web-based/html API tool is is in the works. Following a strict style guide, and documentation standards, we’re working hard to make Toolkit code nearly self-explanitory. Where it’s not, the new API system supports in-place updates of the documentation via the web interface and comments on any node so that you can share your experiences, common usage patterns, and frustrations about any API with yourself and your fellow Dojo developers. We expect this new tool to be integrated with the main Dojotoolkit.org site very soon.

While a few of the public API’s may change before 1.0, those changes will be minimal, and we are confident Dojo is stable enough to being building apps with. And though we’ve been working hard these last months, like any open source project, it is almost entirely community supported. We need your help and feedback to pick out all of the world problems that occur. Whether you file bugs, contribute to the book, help flesh out the porting guide, or answer questions in the forums, everything you contribute helps and is greatly appreciated.

We would like to thank everyone involved in making this milestone beta release a reality. Without tremendous personal effort and organizational fortitude and support, 0.9 would not be happening. We’ve taken a great risk and it has only come this far because the Dojo Team pushed it this hard. In particular, Eugene, Adam, Scott, Owen, Becky, Craig, Bill, Tom, Torrey, Doug, Jared, the rest of the new committers, and the old hands who have so deftly guided the process all deserve hearty, well-earned thanks. Salud.
read original

LINQ to SQL (Part 3 – Querying our Database)

The third part from Scott Guthrie’s series LINQ to SQL:

Last month I started a blog post series covering LINQ to SQL. LINQ to SQL is a built-in O/RM (object relational mapping) framework that ships in the .NET Framework 3.5 release, and which enables you to easily model relational databases using .NET classes. You can then use LINQ expressions to query the database with them, as well as update/insert/delete data from it.

Below are the first two parts of my LINQ to SQL series:

In today’s blog post I’ll be going into more detail on how to use the data model we created in the Part 2 post, and show how to use it to query data within an ASP.NET project.


Northwind Database Modeled using LINQ to SQL

In Part 2 of this series I walked through how to create a LINQ to SQL class model using the LINQ to SQL designer that is built-into VS 2008. Below is the class model that we created for the Northwind sample database:

step1 LINQ to SQL (Part 3   Querying our Database)


Retrieving Products

Once we have defined our data model classes above, we can easily query and retrieve data from our database. LINQ to SQL enables you to do this by writing LINQ syntax queries against the NorthwindDataContext class that we created using the LINQ to SQL designer above.

For example, to retrieve and iterate over a sequence of Product objects I could write code like below:

step1 LINQ to SQL (Part 3   Querying our Database)

In the query above I have used a “where” clause in my LINQ syntax query to only return those products within a specific category. I am using the CategoryID of the Product to perform the filter.

One of the nice things above LINQ to SQL is that I have a lot of flexibility in how I query my data, and I can take advantage of the associations I’ve setup when modeling my LINQ to SQL data classes to perform richer and more natural queries against the database. For example, I could modify the query to filter by the product’s CategoryName instead of its CategoryID by writing my LINQ query like so:

step2 LINQ to SQL (Part 3   Querying our Database)

Notice above how I’m using the “Category” property that is on each of the Product objects to filter by the CategoryName of the Category that the Product belongs to. This property was automatically created for us by LINQ to SQL because we modeled the Category and Product classes as having a many to one relationship with each other in the database.

read original