.net 4.5 new features Chapter 1 :ASYNC and AWAIT KEYWORD

You all caught the official launch of Visual Studio 2012 and .Net Framework 4.5 this past week? If not you can catch the keynotes and a number of great sessions on-demand here.
So I hear some of you asking, "What's new in .Net Framework 4.5?" Wouldn't it be kind of cool if there were an app for our Modern App Monday that provided that information? One that comes with source of course! And wasn't just a simple app, but hooked into a web backend using the Web API, Jason.Net and even Code First Entity Framework?

What's New in the .NET Framework 4.5

The ".NET Feature Catalog" uses .NET 4.5 to build an end-to-end sample from a web backend to a Windows Store app. It allows the user to peruse through some of the features introduced over several versions. This was demoed in TechEd 2012 North America and Europe.
The .NET Framework 4.5 introduces a number of features to help solve the programming problems of today. This sample demonstrates end-to-end how to build a Windows 8 app that connects to a web backend using industry standard REST APIs. If you were at TechEd 2012 in North America or Europe, we showed you how to build this sample from scratch. The app itself is a catalog of some features found in the .NET Framework, so you can learn more about .NET simply by exploring the app.
Description
The sample is best experienced by watching the talk for What's New in .NET 4.5 from TechEd 2012. Click on either of the following to see the presentation given by Brandon Bray or Layla Driscoll respectively.
image image
The main features we cover in the sample are:
  • WebAPI for building REST based web services
  • Entity Framework using Code First and migrations
  • Windows Store app using the .NET for Windows Store Apps profile
  • Async and await to build a fast and interactive user experience
  • HttpClient for an easy way to connect to a web service
  • NuGet for acquiring the latest libraries, specifically Json.NET
Here's a brief road map of the source;

Source Code Files

This sample was created with the default project templates for Windows Store Grid App and an ASP.NET MVC 4 Web Application. The files that were edited during the TechEd demo were:
  • DotnetCatalog/DataModel/FeatureDataSource.cs - used async, HttpClient, and Json deserializing
  • WebBackend/Controllers/FeaturesController.cs - contains the REST APIs for the feature data
  • WebBackend/Controllers/FeaturesSummaryController.cs - contains the REST APIs for the feature summary data
  • WebBackend/Models/Feature.cs - contains the data model for the feature entity
  • WebBackend/Models/FeatureContext.cs - used entity framework
  • WebBackend/Models/FeatureSummary.cs - contains the data model for the feature summary entity
  • WebBackend/WebAssets - the media and text data transferred from the web backend to the Windows app
Here's a snap of the Solution;
image
And the app running at 1366x768;
image
And 2560x1440;
image
image
And to just show that it is indeed all running locally, I put a breakpoint in the Features Controller...
image

Comments