Register | Login

Stacking Code

public interface IBlog { string Dump(Stream consciousness); }

Reasons Why I Avoid Entity Framework 4

Wednesday, 26 January, 2011 @ 11:04 AM < Adam Boddington
Tags: Entity Framework, FluentNHibernate, NHibernate

It's true, I have a general aversion to EF, partly from the negative reviews of EF1 and partly because that problem space has been solved for me for a long time with NHibernate. As a result I haven't checked out the latest incarnation of EF as yet, which made the recent series by Dino Esposito on the functional differences between EF4 and NHibernate a valuable read.

I was surprised to find out EF4 has a respectable story for working with POCOs. Dino came to the conclusion that for the majority of scenarios EF4 is quite adequate. So what exactly is stopping me from giving it a go? Here is my shortlist of excuses reasons.

  • NHibernate's breadth of fetching strategies. NHibernate lets me load a lazy collection a number of different ways, and I can specify the fetching strategy at the time of of the query or in the mapping file.

  • EF's lack of a second-level cache. Without a second-level cache, my mediocre designs would be hitting the database a lot more often than they do right now. It really is a wonderful feature.

  • Lazy properties, new in NHibernate 3.0. This is where a property like a byte array can be defined as lazy even though it's not a mapped entity. It should eliminate some workarounds I have in a few of my projects.

  • The choice of DBMS. This is still an attractive feature of NHibernate. SQL Server CE looks great, but there are more than a few very usable database platforms out there. The option to deploy an application on any DBMS is a nice-to-have, for OSS projects in particular.

When it comes down to it, as Dino says, NHibernate is a mature framework with most of its quirks worked out. The feature set is impressive and deep enough to cover off the complex scenarios whenever they arise. In addition, the community continues to come up with easier ways to use it with initiatives like FluentNHibernate and QueryOver. Overcoming all that is a tough ask for a new ORM, but perhaps the next version of EF will be a bit more compelling.

There are 0 comments.


Leave a Comment

Please register or login to leave a comment.

Assembly Versioning with Hg

Better Living Through Chemistry

Assembly Versioning with Hg

Better Living Through Chemistry

browse with Pivot



Building Neno

Recent Posts

Codility Nitrogenium Challenge
OS X Lock
HACT '13
Codility Challenges
Priority Queue


Architecture (13)
Brisbane Flood (1)
Building Neno (38)
C# (4)
Challenges (3)
Collections (1)
Communicator (1)
Concurrency Control (2)
Configuration (1)
CSS (5)
DataAnnotations (2)
Database (1)
DotNetOpenAuth (2)
Entity Framework (1)
FluentNHibernate (2)
Inversion of Control (5)
JavaScript (1)
jQuery (4)
Kata (2)
Linq (7)
Markdown (4)
Mercurial (5)
NHibernate (20)
Ninject (2)
OpenID (3)
OS X (1)
Pivot (6)
PowerShell (8)
Prettify (2)
RSS (1)
Spring (3)
SQL Server (5)
T-SQL (2)
Validation (2)
Vim (1)
Visual Studio (2)
Windows Forms (3)
Windows Service (1)


Powered by Neno, ASP.NET MVC, NHibernate, and small furry mammals. Copyright 2010 - 2011 Adam Boddington.
Version 1.0 Alpha (d9e7e4b68c07), Build Date Sunday, 30 January, 2011 @ 11:37 AM