I decided to revisit Entity Framework for a project I’m working on. It’s been a while since the last time I gave EF a fair shake (way back when it was first released). I can sum up my impressions of the 4.5 version with a single word: disappointing. EF has come a very long way since the initial release, no question about that, but there are still so many areas where NHibernate trumps it that I can’t imagine using it for a real production app. Code First is a pale imitation of Fluent NHibernate, and EF’s schema generation capabilities are very limited compared to what NHibernate can do. For example, I cannot do something as simple as define a unique key, nor can I incrementally update the schema of an existing database without using migrations. The only point that I do actually like is the idea of the DbContext as a “gateway” to the database. I think this would make it easier to enforce aggregate root boundaries when compared to NHibernate’s overly-powerful (and overly-complex) ISession interface.
Tags: