Welcome to blogs.conchango.com Sign in | Join | Help

Welcome to blogs.conchango.com

Simon Brown's Blog

MSDN Roadshow Re-Run

I recently attended a re-run of the MSDN Roadshow at Microsoft's office in Victoria, London.

It was an overview of the latest offerings from Microsoft in the development space.

The agenda was as follows:

The most interesting bit for me was the first session on the Entity Framework and ADO.NET Data Services.  Entity Framework is an Object Relational Mapper (ORM) and Microsoft's answer to the hugely popular nHibernate.  The Entity Framework still has a few quirks and is lacking in certain areas, and Microsoft seem to acknowledge this fact to their credit. It definitely seemed like a move in the right direction though with some pretty neat features.

As you would expect, Microsoft have included a wizard in Visual Studio (Entity Data Model Wizard) which you can point to a database, select the tables you're interested in, and it will generate your Entity Data Model for you.  The data model consists of three different layers, each having it's own XML file and generated classes as follows:

  • Conceptual layer - The business entity model which is defined in an XML file using the Conceptual Schema Definition Language (CSDL)
  • Storage layer - A representation of the database schema which is defined in an XML file using the Store Schema Definition Language (SSDL)
  • Mapping layer - The mapping between the Conceptual and Storage layers which is defined in an XML file using the Mapping Schema Language (MSL)

An entity class is generated for each table in the database and also handles relationships by for example adding an Orders property (collection of Order objects) on the Customer class.  Once the Entity Data Model has been generated it can then be manipulated by changing the XML files or the entity classes.

The Conceptual layer of the data model is queried by the developer using either Entity SQL (T-SQL like syntax for querying entities) or Linq (Linq for Entities). I can't imagine that anybody is going to be using Entity SQL when they can use Linq with it's expressive fluent interface.  Eric recommended a tool to assist with writing Linq queries called LinqPad.

The Entity Framework also handles updates to the database including features such as Unit of Work and Identity Tracking (handling dirty data - updates which have occurred since the last database read) and Lazy Loading (this is possible, but not out-of-the-box, Eager Loading is the default mode).

I'm not sure whether Microsoft have done enough to convince nHibernate users to convert to using Entity Framework.

When Eric then went on to talk about ADO.NET Data Services that's when I started to see some real benefit to using the Entity Framework instead of nHibernate.  Eric demonstrated the creation of a fully RESTful service with only a couple of lines of code.  You can essentially just create a service which inherits from your Entity Data Model and "Hey Presto!" you have a RESTful service covering all CRUD operations throughout your entire data model!  No need to create services anymore with methods like GetProductsById() or GetProductsByUserIdSortedByDate() or AddProduct() for each entity. This is all handled by ADO.NET Data Services.  Very impressive stuff indeed!

I was even more impressed when Mike Ormond went on to talk about ASP.NET Dynamic Data.  You can register your Entity Framework Data Model with Dynamic Data and a fully functional CRUD website with friendly urls is created for you using data driven page templates.  RequiredFieldValidators are added for non-nullable fields, entry is limited to the number of characters the field can hold in the database, different controls are rendered based on the type of the field (e.g. check boxes for boolean values). This would be great for getting a fully functional site up and running really quickly, maybe for a prototype, or for a back end administration or simple Call Centre application.

To me this is where Microsoft really starts to excel.  Their development teams seem to be working towards a common goal, with each product being built on a common framework. They develop functionality which can be utilised across their range of products.  They make it easy for developers to get up and running really quickly and concentrate on delivering real business value, rather than writing boilerplate code. My only worry with this approach is that it's fine for simple applications but when things become more complex you start to hit problems.  I'll have to give Microsoft the benefit of the doubt on that one as I haven't started to use any of this in anger yet!

There were some other interesting features demonstrated by Mike Ormond such as the AJAX history control, a preview of ASP.NET MVC and it's routing engine (which is also used for DynamicData), and the Silverlight ASP.NET controls <asp:Silverlight> and <asp:MediaPlayer>.

Mike Taulty discussed Silverlight 2 and Deep Zoom, and developed some Media Player Silverlight applications.  He also showed us some good examples of Silverlight/Deep Zoom applications (Hard Rock Cafe, Media Toaster and Microsoft Downloads).  He talked about the use of the HTMLPage and HTMLElement classes which can be used to manipulate the web page DOM from within a Silverlight application, retrieving data using limited SOAP or JSON services, and the storage of data on the client's machine using Isolated Storage.

IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageSettings.ApplicationSettings["SettingName"];
IsolatedStorageSettings.ApplicationSettings.Save();

Neil Kidd then went on to give a demonstration of the Visual Studio Team Suite.  This was mainly a demonstration of the test tools which have been around for a while now but also Database Professional (previously Data Dude) which was hugely impressive.  Database Professional creates a separate file for each artifact (table, index, constraint, stored procedure etc) and contains impressive refactoring capabilities.  You can change the name of a field in a table and it will automatically change the name in each of the places this is used (stored procedures, constraints etc). You can use the tool to compare the database project to an existing instance of the database and it will create update scripts for you to deploy changes. Neil also demonstrated writing database unit tests for testing stored procedures. DBA's have no excuses now!  Database Professional also has an impressive tool for generating large amounts of varied test data based on rules you can specify.  Very useful for performance testing.  All-in-all a very nice looking product.

So, to conclude it was a very good event, with some very impressive new technology demonstrated, especially around Entity Framework, ADO.NET Data Services and ASP.NET Dynamic Data.  Lots more for me to look at in my quest for continuous improvement!

Comments

 

jamie.thomson said:

Hiya Simon,

I wouldn't mind knowing more about Dynamic Data. Fancy doing a presentation internally on it?

-Jamie

November 9, 2008 07:57
Anonymous comments are disabled
Powered by Community Server (Personal Edition), by Telligent Systems