Entity Framework dramatically faster in .NET 4.5

The Entity Framework is often shown lagging behind in performance comparisons with other ORM’s, especially when micro ORM’s are also included in the mix.

For example the Dapper benchmarks show the Entity Framework in a distant last place when testing SELECT mapping and serialization. These results have been charted on the excellent ServiceStack website.

However things have changed in .net 4.5 and the Entity Framework is no longer the slouch it once was.

The chart below shows the same benchmark, but this time including how the ORM’s fare when run on .NET 4.5.

The benchmark measures how long in milliseconds it takes to execute 500 SELECT statements against a DB and map the data returned to objects.

[easychart type=”vertbar” height=”100″ title=”Performance of SELECT mapping over 500 iterations” groupnames=”.NET 4.5, .NET 4″ groupcolors=”005599,229944″ valuenames=”Hand coded, Dapper,OrmLite,PetaPoco,NHibernate,EF Compiled ,EF, Linq 2 SQL,NHib LINQ” group1values=”66,67,71,75,126,133,183,188,530″ group2values=”68,69,80,78,134,133,888,212,657″]

Now the Entity Framework competes with the other ORM’s on performance, and when compared with a fully featured ORM like nHibernate it compares very favourably (at least on this one metric).

It gets nowhere near the micro-ORM’s on performance, but feature rich ORM’s never will.

What is also interesting is that quite a few of the ORM’s also gain speed improvements in .NET 4.5

Introducing Kameleon: An MVC Blog Application

I have just switched my blog over to Kameleon.

Kameleon is a new blog application that I have been developing this past week using ASP.NET MVC. There are a lot of great blog applications for .net including SubText, DasBlog and blogengine.net, but building your own is a great way to explore a web framework. I plan to use Kameleon to capture some of the trails and tribulations on developing with MVC and also trying to work out some of the emerging best practices.

The application is only in its embryonic stages at the moment but it has most of the standard blog features.


Posts, Pages, Comments, Feeds, Categories and Tagging

All quite valuable assets of a blog application 🙂

Skin Engine

It features a very flexible and simple skin architecture. At its most simplest a skin can be a folder with a master page, a stylesheet and few images in. However every base page or control template can be overridden by just dropping an aspx in the skin folder to provide complete flexibility. Obviously its better if most of the customisation is done in the CSS, but its useful for converting themes from other blogging engines.


The Widgets in the sidebar are data driven and what appears (or not) in the sidebar can be controlled via the admin. Currently, each widget is called in via a RenderAction, I will expand on this in a future post. (I am still not sure if it this the cleanest way to have widgets)


I use the excellent Lucene to search and index blog posts. When content is added or updated, it is updates the index and invalidates any cache.

MetaWeblog API

Support for blog clients.

Windows Live Writer support

A bit of extra support for Windows Live Writer so that it can auto-detect Kameleon’s API and its capabilities.

Clean friendly URL’s

As Kameleon is built with ASP.NET MVC, you get clean friendly URL’s out of the box.

Multiple Blogs

A single instance of Kameleon can run multiple blogs. The blog (and skin) can be auto-detected from the incoming request (domain).


It is has been made using the following ingredients:-

  • Subsonic 2.1
  • SQL Server
  • Lucene.Net
  • Elmah
  • Log4net
  • ASP.NET Membership & Role Providers

What next?

There are still a few features that are missing, the Admin side needs building out and support for trackbacks and pingbacks is required. I also need to improve test coverage and do some refactoring.

I will put the source code on Google Code/Codeplex when its been whipped into shape a bit more.

Other MVC blog applications

Part way through this week Oxite was announced by Microsoft  I haven’t really had much time to look into it, but it looks like being an excellent real world example of an MVC application. You can find it on CodePlex It is well worth a look.

Also looking forward; SubText 3.0 will be developed using ASP.NET MVC, and that is worth keeping an eye on.