ScottGu's Blog
Scott Guthrie lives in Seattle and builds a few products for Microsoft
-
May 22nd Links: ASP.NET, Visual Studio, Silverlight, WPF and .NET
One of the things I'm going to try and start doing is a weekly blog post of useful/interesting links on .NET related topics that I've found on the web. Below is this week's version:
-
Using LINQ to SQL (Part 1)
Over the last few months I wrote a series of blog posts that covered some of the new language features that are coming with the Visual Studio and .NET Framework "Orcas" release. Here are pointers to the posts in my series:
- Automatic Properties, Object Initializer and Collection Initializers
- Extension Methods
- Lambda Expressions
- Query Syntax
- Anonymous Types
The above language features help make querying data a first class programming concept. We call this overall querying programming model "LINQ" - which stands for .NET Language Integrated Query.
Developers can use LINQ with any data source. They can express efficient query behavior in their programming language of choice, optionally transform/shape data query results into whatever format they want, and then easily manipulate the results. LINQ-enabled languages can provide full type-safety and compile-time checking of query expressions, and development tools can provide full intellisense, debugging, and rich refactoring support when writing LINQ code.
LINQ supports a very rich extensibility model that facilitates the creation of very efficient domain-specific operators for data sources. The "Orcas" version of the .NET Framework ships with built-in libraries that enable LINQ support against Objects, XML, and Databases.
What Is LINQ to SQL?
LINQ to SQL is an O/RM (object relational mapping) implementation that ships in the .NET Framework "Orcas" release, and which allows you to model a relational database using .NET classes. You can then query the database using LINQ, as well as update/insert/delete data from it.
-
Tip/Trick: Supporting Full Screen Mode with Silverlight
One of the nice features that Silverlight supports is the ability to go "full screen" and effectively take over the entire screen of a computer (hiding everything else from sight - including the browser frame). This can be very useful when building immersive UI experiences, games, rich video players, etc.
-
New "Orcas" Language Feature: Anonymous Types
Over the last two months I've published a series of posts covering some of the new language features that are coming as part of the Visual Studio and .NET Framework "Orcas" release. Here are pointers to the first four posts in my series:
- Automatic Properties, Object Initializer and Collection Initializers
- Extension Methods
- Lambda Expressions
- Query Syntax
Today's blog post covers the last new feature in my language series: Anonymous Types.
What are Anonymous Types?
Anonymous types are a convenient language feature of C# and VB that enable developers to concisely define inline CLR types within code, without having to explicitly define a formal class declaration of the type.
Anonymous types are particularly useful when querying and transforming/projecting/shaping data with LINQ.
Anonymous Type Example
In my previous Query Syntax blog post I demonstrated how you could transform data with projections. This is a powerful feature of LINQ that enables you to perform query operations on a data source (regardless of whether it is a database, an XML file, or an in-memory collection), and shape the results of the data being queried into a different structure/format than the original data source is in.
In my previous Query Syntax blog post I defined a custom "MyProduct" class that I used to represent my transformed product data. By explicitly defining the "MyProduct" class I have a formal CLR type contract that I can use to easily pass my custom-shaped product results between web-services or between multiple classes/assemblies within my application solution.
However, there are times when I just want to query and work with data within my current code scope, and I don't want to have to formally define an explicit class that represents my data in order to work with it. This is where anonymous types are very useful, as they allow you to concisely define a new type to use inline within your code.
-
Silverlight
Last Monday I delivered one of the keynotes at the MIX conference in Las Vegas, and discussed a new project that I've been spending most of my time working on over the last year: Silverlight.
-
IIS 7.0 Beta3 Ships with a Go-Live License
This week we shipped IIS 7.0 Beta 3 as part of the Windows "Longhorn" Server release. IIS 7.0 is the biggest release of IIS in the history of the product, and brings with it major improvements to the Microsoft web-server stack. This article and this blog post list just a few of the major improvements it delivers.
-
Javascript Intellisense in Visual Studio "Orcas"
In February I did a blog post called My "First Look at Orcas" Presentation. It provided a good summary of some of the cool web development features coming with Visual Studio "Orcas". If you haven't had a chance to read it, I recommend checking it out here.
-
Public Hotfix Patch for VS "Index was outside the bounds of the array" Publish Website Issue
Two weeks ago I posted about the availability of a public hotfix patch for some ASP.NET 2.0 compilation issues. You can read about this patch in my post here.
-
New "Orcas" Language Feature: Query Syntax
Last month I started a series of posts covering some of the new VB and C# language features that are coming as part of the Visual Studio and .NET Framework "Orcas" release. Here are pointers to the first three posts in my series:
- Automatic Properties, Object Initializer and Collection Initializers
- Extension Methods
- Lambda Expressions
Today's blog post covers another fundamental new language feature: Query Syntax.
-
Update of SQL Server Database Publishing Toolkit for Web Hosting
A few months ago I posted about the new SQL Server Database Publishing Hosting Toolkit built and published by the SQL Server team. You can read about what it offers and how to use it in these previous two blog posts of mine: