Quantcast
Channel: Sam's Code » nhibernate
Viewing all articles
Browse latest Browse all 4

More EF4 vs NH Discussion

$
0
0
There’s a post on InfoQ following up the the Entity Framework 4 vs NHibernate (EF4 vs NH) discussion that Ayende started. I posted some of my findings regarding loading of large or complex object graphs in the comments. I have done more research in that vein (it turns out you CAN load a whole object graph in NH, as long as you map your collections to <set>’s instead of <bag>’s), but you may not like the performance results. You end up with a cartesian product of the records in every table that you end up joining to. NHibernate joins all of the tables flat, while EF combines subqueries, joins, unions, etc, to get JUST the rows you’re after, with no multiplication. However, unless you’re loading very large, complex graphs, with a lot of related entities and collections, you’ll probably be fine.

I set up the AdventureWorksLT2008 database, and have both an EF and a NH model hitting it, so I can do comparable queries, and look at the SQL generated by running a trace in SQL Server Profiler. When I get more of those results organized and coherent, I’ll post them here.



Viewing all articles
Browse latest Browse all 4

Trending Articles