views:

23

answers:

1

I haven't gotten into ORM frameworks much yet, and could use some input from experienced practitioners. Some of these questions may be naive. Please bear with me.

  1. In mapping objects to relations, do these frameworks also suggest indices that may be necessary for the queries to execute efficiently?
  2. The queries generated by ORMs, are they efficient in the relational domain? Do they mostly work fine as generated, or is there intervention required?
  3. What is the current consensus on the ORM of choice in the .NET world?
+1  A: 

I have experience with Entity Spaces, a little with Entity Framework, and also some with NHibernate.

  1. Not in my experience. Use Query Analyzer or similar for that.
  2. Generally yes, but beware of the N+1 problem. Entity Framework allows you to pull back entities "with" child entities. NHibernate tries to be smart about it. You do have to keep an eye on what SQL is being generated, particularly for costlier queries.
  3. The TDD crowd favors NHibernate because it allows you to use POCO entities (and they tend to prefer the Unit of Work over the Active Record pattern for testability). On the other hand, Entity Framework comes with Visual Studio. Then again, there's always Linq to SQL (much lighter weight).
Scott Whitlock
BTW EF can use POCO entities too now.
Hightechrider
@Hightechrider: I looked at that, and was unimpressed with the amount of work to do it. I hope they make it a bit easier in future versions.
Scott Whitlock