Archives
-
Microsoft Surface and WPF
Microsoft earlier today announced a new product called "Microsoft Surface". If you haven't checked out the online videos of it yet, I highly recommend watching them here. It is one of those products that looks and feels like it comes from a science fiction movie - but it is actually real.
-
LINQ to SQL (Part 2 - Defining our Data Model Classes)
In Part 1 of my LINQ to SQL blog post series I discussed "What is LINQ to SQL" and provided a basic overview of some of the data scenarios it enables.
-
My Upcoming Presentations in Orlando, Budapest, Amsterdam, Zurich, Mountain View and Phoenix
June is going to be a really busy travel month for me. I'll be presenting at the following events if you are interested in attending and stopping by to say hi:
-
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.