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

Mocking Jon Skeet

I have been using Balsamiq (a mockup tool) a lot since I purchased it a few weeks ago. It had the likeability factor from the off, and has proved pretty useful.

Before using Balsamiq I had experimented with other tools but mostly I tried blundering and man handling applications such as Visio or Dreamweaver in to producing mockups. The biggest problem I had with those tools is that they got in the way. I spent more time trying to get them to do what I wanted, than I did brain storming, capturing an idea or mocking up a screen.

Balsamiq is a little different in that it is very specialised; it is designed to do mockups and very little else.


It has almost no learning curve to get started, and produces nice looking mockups. As a result it doesn’t get in the way, and you find more of your time is thinking about your idea or your page, rather than worrying about the tool

Then there is the produced mockups themselves. There is a great advantage to having a mockup that looks informal and almost hand drawn. Everybody who looks at the mockup knows its a mockup, and not the first attempt at a design. This means you can discuss more about the idea and how it might work than perhaps discussing fonts, and
nit picking about different elements.

I used Balsamiq to create the initial mockups for Ask Jon Skeet. It is probably an over-simplified example of how you might use Balsamiq, but even for something this simple it boosted my productivity. I have zero design skills, so I lean heavily on web designers when it comes to building a website. In the past most of the information I have given the designer has been textual or verbal, but providing a mockup of a screen can help immensely and is an easy and quick way to convey an idea more clearly.

An example of how the homepage for Ask Jon Skeet went from concept to design.





Balsamiq are a small team, and seem to be pretty agile – they usually release updates each week. You can read more about the latest developments on their blog.

They also seem to be open to new ideas and suggestions. I am looking forward to when they introduce linking mockups, and allowing some sort of template inheritance.

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.

Vista x64 Tipping Point

I have recently built a new development machine and had a difficult decision to make in regards to whether to go with x64 Vista or x86. It wasn’t an easy decision, or a particularly obvious one.

Vista x64

The Pros

  • Large memory support

    The biggest advantage of going x64 is the ability to make use of more memory, potentially up to 128+GB. 32 bit version of Vista has a limit of 4GB, but in practice you will only get to use about 3GB as RAM). Having more memory should allow for better performance, as well as opening the doors for better VPC usage.

  • Improved Stability

    Due to Vista x64 demanding only signed drivers can be installed, there OS should potentially be more stable than its 32 bit sibling.

The Cons

  • Poor Driver support

    All x64 drivers have to be signed. This isn’t such a problem for new hardware/software but legacy support for existing devices would be limited compared to x86.

  • Software compatibility issues

    Some older software (and computer games) will still have problems running under Vista x64

  • Lack of true 64 bit software

    Most software that is currently available is 32 bit, and does not have a 64 bit alternative. This isn’t going to change quickly, and it is difficult to foresee when it is actually going to change wholesale. In Vista’s lifetime would be nice, but it is not guaranteed.

The decision

In the end I went for Vista x64, mostly because I wanted to make use of more than 3GB of memory. Had it been a year earlier, I would definitely have gone 32 bit. The landscape has dramatically changed over the last year, and driver support has come on leaps and bounds.

If you have a reasonably new PC, and recent hardware you probably won’t run into any show stoppers. Also on the software front, a lot more has been done to ensure computability with x64. All said and done, I only really gained enough confidence* in 64 bit Vista because of Scott Hanselman’s well documented 64 bit journey with a very similar specced quad core PC. It was clear that, although I may have some teething issues, all the core tools for software development should work fine. Jeff Atwood goes into more detail in regard to whether 64 bit is ready in his recent post Is It Time for 64-bit on the Desktop?.

*And if there were any major problems, I would have Scott Hanselman to nag 😉

Real world experience

In the first few weeks of running Vista I have had no real issues at all. Everything has worked, and it’s been a much smoother experience than I anticipated. I would have no hesitation in recommending x64 to any other software developer who is considering making the leap to 64 bit -as long as they require >3GB memory.

The only vague disappointment I have had is that I wasn’t quite aware just how many applications out there don’t have a 64 bit version available. If I open up Task Manager, I can see a good 1/3 of the processes are running in 32 bit emulation. This is a little disappointing, and is mostly down to how Microsoft is bringing in 64 bit so slowly. 32 bit is still going to be recommended Vista edition for the foreseeable future.

Microsoft has an interesting page on which edition of Vista to choose.

In the consumer market, Windows Vista 64-bit editions are for serious gamers, high-quality media creators, and enthusiasts who demand the most from digital media and are running computer systems with 64-bit processors.

The 64-bit editions of Windows Vista are not for everyone, and require a system with a 64-bit processor and 64-bit system drivers. Please confirm that your system, applications, and devices are compatible with a 64-bit edition of Windows Vista before installing.

It is clear Microsoft do not want to encourage anybody other than enthusiasts and professional to go 64 bit, as it’s not going to be plain sailing by any means

Tipping Point

So, when will x64 become mainstream? Will it be in Vista’s lifetime?

I have my doubts. For your average non-techie user, Vista runs okay on 1GB and runs very well on 2GB. I don’t see this changing over the next 2-3 years. Professionals and enthusiasts are bound to move across to 64 in large numbers as driver support continues to improve, but this is still such a small user base for Vista.

Vista x64’s tipping point will never be reached organically, so the question is will Microsoft decide to push Vista x64 over the next couple of years? Or will they wait for the next OS release, and make it a x64 only release. Seems to me like the latter is more likely.

In the meantime, I will continue enjoying the solid experience of developing software on a 64 bit OS, but I won’t be expecting to fully wave goodbye to 32 bits for a good few years.

Hipster Shuffle

Updated: See the Hipster Shuffle in action on YouTube

You may have recently seen the wonderful invention that is the Hipster PDA (hPDA). It is a fantastic innovation that has been adopted by many a GTD follower. But what is the Hipster? Quoted from the Hipster Wikipedia definition:-

“The Hipster PDA is a paper-based personal organizer popularized, if not invented, by San Francisco writer Merlin Mann.”

Here is an example of a Hipster PDA.


Despite its obvious genius, some doubters have suggested that the Hipster PDA isn’t a ‘true PDA’ or even a PDA at all. The non-believers have stated that even though it features limitless battery life, customisable fonts, and true persistance – this all comes at the expense of multimedia functionality. Many Hipster users argue that the hPDA’s simplicity is one of the main factors of its success.

This for some people is not enough.

What is the solution? Some sort of middle ground perhaps. The answer would come from an unlikely source.

Apple have long been known for their creative innovation, and who was to know they had become aware of the ground breaking Hipster and were about to release the ultimate accessory or upgrade. Yes folks, the ultimate mash up of paper and silicon has arrived.
Meet the ultimate upgrade for the Hipster, uncannily referred to by Apple by the codename “iPOD shuffle (2nd generation)” otherwise known as the “Hipster Multimedia Clip”.


Forget the iPhone, Apple have really made a miracle happen here. If you are in any doubt, lets see the Hipster Multimedia Clip in action:- hipstershufflelogofacing


The Multimedia Hipster clip can also be inversed to have the controls the other way around. See below:-


Its really quite amazing. Wherever you take your Hipster, you also take your music collection. Get in to the groove whilst you GTD.

Upgrade your Hipster to a Hipster Shuffle today with the fabulous Multimedia Hipster Clip. Available now from Amazon – curiously still under its code name iPod shuffle.

See the Hipster Shuffle Video of how it changed my life on YouTube.


The technology challenge of GTD

The concepts of GTD are relatively simple; it’s in the implementation where the complexity lies. GTD relies on having a trusted system were you capture information, thoughts, and next actions etc. The system needs to be trusted, because if you are getting all of your commitments and to-dos out of your head, your head really needs to trust that it can stop thinking or worrying about them.

Without a trusted system, it doesn’t work. I would say that for the majority of geeks the road to finding a trusted system is full of obstacles. I would be prepared to go out on a limb and say that most people who have been caught up with the cult of GTD don’t actually practice GTD.

Where is the resistance?

And does there have to be     that much resistance, for a target market of people who most probably have a hefty workload and/or a problem with procrastination?

The problem.

First of all the problem. Let’s take a look at a fictional geek called Geoff, who just happens to be a software developer. His setup is the following:-

  • Home PC
  • Laptop
  • Work PC

He uses Outlook for email, he also has a gmail account, and he is restricted to what websites he can use at work.

Geoff has decided he is getting snowed under and could do with a better way of managing his time (his stuff to do). He has done some research and has decided to give GTD ago. It seems pretty simple and effective, and is completely sold on the idea.

First step – finding the trusted system.

Geoff loves web surfing, he loves finding tools, and his attention span is similar to that of a goldfish. He hops about the internet finding GTD solution after solution, soon learning that finding the perfect GTD solution is like a procrastinator’s wet dream. He continues to put all of his urgent work to one side, and signs up for several of the web applications like Remember the Milk, Backpack and Vitalist and gives them a go. At first they all seems pretty good, they make great use of Ajax and look pretty good too. However not one application is perfect, not one is the right fit for him. Being a geek and a software developer, Geoff knows GTD is pretty simple, he doesn’t want to compromise, and there are still dozens of apps he hasn’t yet tried.

Two weeks later, all of the web GTD accounts are starting to become stale. All the articles on 43folders and lifehacker have been read. Geoff has decided that web GTD apps aren’t for him. He needs the power of a windows application, something that isn’t hidden in the tab of his web browser.

He installs My life Organised and ThinkingRock. Again they both seem pretty good, he decides ThinkingRock is the best fit and decides this time he best give this GTD app a proper try, and to stop procrastinating. He spends the weekend emptying his brain into the application. Monday morning he bungs the application onto a USB stick and goes to work. He gets into the habit of using the app to manage his workload at work, and all is going swimmingly. Until Thursday. Thursday he has left his USB Stick at home. Geoff finds this really frustrating, because his USB stick has his brain on it (and it was only a 1GB stick).

Thursday becomes a bit messy due to not having his brain, and Friday and the weekend are consumed by looking for a more reliable option.

By Monday Geoff realises he has wasted days and days, just surfing for a perfect GTD solution. His boss isn’t happy because he has missed a deadline, and Geoff decides he best knuckle down and stop wasting any more time chasing rainbows.

The End.

The moral of the story? We live in a complicated world, with masses of information thrown at us from all angles. We rely on many devices, from PCs, laptops to PDAs and mobile phones. Not all of them speak the same language.  In the end, there is no perfect GTD solution out there, and there never will be. There are however, plenty of ‘good enough’ solutions that are right for you. It’s more important to find a solution, commit to it and make it work. Once you have a reliable system and are on top of your workload, then there is nothing stopping you from making some time available for looking for smarter solutions, but at least it wont be at the cost of ‘Getting things done’.

ASP.NET Registration with multiple profile providers

When do you decide it is time to give up on using some of the more feature rich ASP.NET controls? When is it easier and/or quicker to code something yourself?

I spent yesterday trying to plug the CreateUserWizard into an e-commerce website. It was very simple to get working and very little code was required. However once I got it working, I then had the interesting task of getting it to produce the required HTML. I edited the templates; getting rid of the entire messy table based HTML, and thought everything was going good. It wasn’t.

When I loaded the registration page up in Firefox, and viewed source, I could see the nice template HTML was surrounded by more hideous HTML that the CreateUserWizard had generated. The hideous HTML was not part of a template so could no be changed.

After googling around I found a very exciting discovery – the ASP.NET CSS Friendly Control Adapters. A set of adapters that can be dropped into an application and will help adapt� the HTML that the ASP.NET controls render, making them CSS friendly.

I wired up the adapters and loaded up my site in Firefox, and then viewed source. Woo hoo, the HTML was fixed, with not a table to be seen.

But then another pothole….

I tried to create a user and hit all sorts of problems. After a bit of debugging, I found out that when the adapters are plugged in, the CreateUserWizard doesn’t quite work the same. My event handlers were not working because the properties such as UserName on the CreateUserWizard were empty! I ended up having to use FindControl to get the values that I needed instead of accessing the properties. I have since found Steven Harman’s excellent blog post – CSS Friendly Control Adapters, CreateUserWizard, and ViewState… Oh My! – that covers this in more detail.

Okay, so I tweaked my code and everything seems to be working again, but from reading more about Steven’s experiences it seems like there may still be some outstanding issues with the CreateUserWizard and the CSS Friendly Control Adapters.
Which brings me to the question at the beginning of the post – When do you decide it is time to give up on using some of the more feature rich ASP.NET controls?

With the CreateUserWizard as an example, there are ways of making it behave properly in terms of the HTML it renders but when do you draw the line? The CSS Friendly Control adapters are a very useful development, but when they affect the behaviour of a component and introduce quite a lot more complexity is it worth the cost?

What have I gained? In this case with the Membership/Profile providers, it would be quite easy to develop a bespoke control.

Any thoughts?

The Start Menu is so last year

I installed an application a couple of months ago that revolutionised how I use my computer. No other utility or application in the Windows XP era has even come close to the sort user experience improvements this application has brought.

So what is it? What’s it called? How much is it?

It is a program launcher called Launchy and it is free.

Program launchers are no secret these days, and I may have come late to the party but WOW what a difference they make. Launchy by default indexes the start menu and your bookmarks, but you can also configure it to index other places, like document/project folders for example.

When you want to launch an application you open Launchy by using a hotkey combination (I use Alt and Space). Then type the first few letters of the application name or bookmark and BOOM, it displays you the most relevant app/bookmark, you press return and it opens. The impressive part is that it adapts and learns what applications you are looking for based on your keystrokes. Here is an example of what I have to type to open my apps.



It is so simple and intuitive, but over the course of a day it saves so much time. I am smitten.

* If you as far behind as I am, and have only just discovered application launchers.