DevConnections 2008
Below are the brief notes that I took while at DevConnections in Las Vegas (November/2008) This blog entry is mostly bullet points of things that I found interesting without much details. I'll elaborate on some of these topics in future blog entries.
Tuesday, November 11th
Opening Keynote
Scott Gu started with an overview of some of the new features released in the last year which included:
- Dynamic data access (to build a database application with a wizard
- Charting controls for ASP.NET
- ASP.NET MVC - TDD friendly, closer to the metal (HTML) programming model, Not for everyone
- Several Silverlight demos
Then he went to describe some of the new things coming in Visual Studio 2010 and ASP.NET 4.0 which included:
- Visual Studio's UI will use WPF rather than Windows Form
- Better support for release and deployment (e.g. support for multiple web.config files, one for each environment)
- Better support for documentation and integration with TFS work items
- Native support for SharePoint
- TDD workflow
- Distributed caching for ASP.NET apps (look for project Velocity)
- NET continuum (web, desktop, RIA)
Chris Hammond has a very nice summary of this sesion.
Entity Framework in a World of Services and Processes
The Entity Data Model (.edmx) generated with the Entity Framework (EF) is serializable by default which makes it compatible with WCF out of the box.
Context in EF is the equivalent to a database connection in data access
Gotcha: You need to enumerate LINQ results before passing them back with the EF if you (as you should) surround your context with a using statement
using (EF context)
{
var blog = from x in ctx.Blogs select y;
return blogs.ToArray() // enumerate before end of using
}
In my opinion, the Entity Framework seems unfinished. Although EF makes really easy to ready data using an object model the interface to save data (inserts and updates) looks complicated. Several "hacks" were needed to save data. The problem seems to stem from the fact that the EF is very good understanding state but not inferring intent. Currently all operations apply to the entire object graph and there is no easy way to make operations more granular. This will be worked out in version 2.
ADO.NET Data Sets (formerly known as Astoria) makes data accessible through HTTP via a REST approach. In this approach the intent is inferred from the URL.
SOAP uses lots of verbs while REST few verbs (put/get/post/delete) but lots of nouns.
ASP.NET MVC - so what?
Scott Hanselman gave a very good presentation describing what MVC provides and does not when compared with traditional ASP.NET Web Forms.
The first thing he clarified is that ASP.NET is greater than MVC or WebForms. Secondly, both approaches are here to stay. They target different audiences.
ASP.NET with Web Forms hides HTML from the developer and adds a state subsystem to HTML.
MVC is a new project type in ASP.NET. It gives the developer more control over the HTML, lends to code easier to test (TDD friendly), but it is not for everyone. Unlike WebForms there are no event in MVC, that is there is no button’s click event, no page postback, no viewstate, and no page lifecycle.
If we lose so many “web form” features with MVC, isn’t it like going back to classic ASP? No, there was no separation of concerns in classic ASP (more on this below) the code was all lumped in a single page and it wasn’t easy to test.
You can mix and match WebForms and MVC in a single web site.
A typical URL in an MVC follows this format: http://controller/method/methodparameter, for example: http://products/retrieve/3
The name MVC comes from the Model View Controller pattern. Sites with MVC use a controller (C) to interact with a model (M) to get data and return views (V). This model enforces a clear separation of concerns between the model, the view, and the controller, for example, the controller does not know anything about HTML, that’s the job of the view. The view does not know anything about the database, that’s the job of the model.
The default view used by MVC uses WebForms. You can build your own or use third party views. Scott showed a kind of view using a third party product called NHAML that was quite different to a traditional WebForm way of constructing an HTML page.
LINQ to everything
The speakers gave a tour of all the different LINQ flavors to query a variety of data sources. Slides can be found at http://blogs.msdn.com/aconrad/
LINQ to objects - Provides a mechanism to query objects.
LINQ to SQL – Provides LINQ’s functionality but targeting a database (SQL Server only) rather than objects.
LINQ to Entities – A higher level of abstraction than LINQ to SQL, includes support for modeling (Entity Data Models) and supports multiple backend via plug-ins (although the only available at this point is for SQL Server)