views:

2935

answers:

1

I am looking for some guideline for my new application while choosing ORM. I want to evaluate EF over NHibernate and LINQ to SQL. I need some expert voice from this wonderful community. You can evaluate on following point.

  1. Scalability
  2. Learning curve
  3. Easy to use
  4. Performance ETC.
+8  A: 

Hi Mahesh,

Well, of the three you've listed, NHibernate has been around the longest. If you want to work with something which has a proven track record, that's probably a safe place to begin.

It is pretty even across the four metrics (scale/learning curve/ease of use and performance) although you might find there is more information available due to it being around longer than the other two.

LINQ to SQL has been released longer than the Entity Framework, but only runs against SQL Server flavours. It works very well as a fit-for-purpose ORM, but is not a feature-rich as the Entity Framework (which provides eSql amongst other things).

LINQ to SQL is pretty easy to grasp (depending on your knowledge of LINQ) and more recently the quality of the generated queries has improved (since the earlier betas). I'm not sure how well it scales, or performs, but you'd have to think it's on par with an average developer's handwritten T-SQL (okay now that's a wild assumption!). It's pretty straightforward, and generates a very nice model for you within Visual Studio.

There are other (2) alternatives for non-SQL Server databases support

The Entity Framework is the newest of the three and as a result, still has some issues to be corrected (hopefully in the next version). It will work with a number of providers (it's not limited to SQL Server) and has additional goodness such as eSQL and (1) Table-Per-Type inheritance. It can be a bit tricky to learn at first, but once you've done one or two solutions with it, it gets predictable and easier to implement.

Due to it being the latest, it'll take a bit more in terms of learning curve (also there's more to learn), and the performance is.. less than desirable (at present) but it does offer some interesting benefits (especially the support for multiple providers).

I guess my question in reply is - are you just evaluating or do you need to produce a workable (production-ready) ORM solution?

The Entity Framework probably isn't quite ready for serious production work (outside of smaller solutions) which leaves you with LINQ to SQL or NHibernate. If you're only going to be working with SQL Server databases, LINQ to SQL is an interesting option. Otherwise, NHibernate is probably the best bet for serious work.

(1) [ http://msdn.microsoft.com/en-us/data/cc765425.aspx ] (2) [ http://www.devart.com/dotconnect/linq.html ]

RobS
1. Linq supports inheritance2. There are LINQ providers for Mysql, Oracle and PostgreSQL.
graffic
Linq to SQl supports Table-Per-Type?
RobS
....Entity Framework is also the only one to properly support a 3-tier design with Webservices between the Data and the front-end
Dave R
also Entity Framework v2 should be much, much better in N-Tier and SOA architectures or so I believe.
RobS