Posts
17
Comments
40
Trackbacks
0
Swapping from NHibernate to Entity Framework – Sanity Check

Now I’m not an expert in either of these techs.  I have a nice framework for unit of work / repository built with NHibernate.  Works pretty well.  I use FluentNhibernate to do the mappings.  Works well.  Takes very little code to get going with a DB back OO model.

So why swap?

Linq.  In Entity Framework you get much better linq support. 

Visibility. I have no idea what's really happening with NHibernate….its a cloud of mystery most of the time.  You have to read all the blogs, mailing lists, etc to know what's going on.

So, EF 4.0 looks like pretty good….  it has reasonably good support for mapping POCOs.  Wrapping UnitOfWork and Repository around it seems ok.

Only thing I haven’t liked too much is having to explicitly load lazy loading entities.

So…. am I sane?  is EF the way to go?  or is NHibernate going to suddenly release the next generation of coolness?  Is there any other major gotchas of using EF over NHibernate?

posted on Thursday, April 29, 2010 2:11 PM Print
Comments
Gravatar
# re: Swapping from NHibernate to Entity Framework – Sanity Check
NA
4/30/2010 12:12 AM
I feel the same way you do and my company is pushing on with EF.
Gravatar
# re: Swapping from NHibernate to Entity Framework – Sanity Check
Daniel Simmons
4/30/2010 10:30 AM
With EF4 you should be able to turn on lazy loading and not need to explicitly load. The only trick is that you need to make sure your collection and reference properties are virtual and you need to set the LazyLoadingEnabled property to true on ContextOptions.

- Danny

Post Comment

Title *
Name *
Email
Comment *