views:

32

answers:

3

I am starting a new project using C# and ASP.NET 3.5 with SQL Server 2005, and I am trying to decide which ORM is the best to use between LinqToSQL, LinqToEntities, or NHibernate.

Ideally I would like to use the preferred Microsoft best practice; but I need to use a solution that will provide performance comparable to using stored procedures without the maintenance overhead, and be easy to deploy updates to the web application and the database since we are in an Enterprise environment and the database is controlled by another group.

I really like the ease of use that LinqToSQL provides, and I am leaning towards any Linq solution over NHibernate.

Thanks in advance for all recommendations!

Jason

+2  A: 

If you're looking for the "preferred Microsoft best practice" then you want to go with the Entity Framework (Linq-to-Entites). Microsoft has said this is where they are focusing their efforts as regards ORM's. LINQ to SQL (I dont think) is being actively developed, other than maintenance and security fixes.

My personal opinion is to go with LINQ to SQL with smaller, simpler projects. The larger more robust applications I prefer to use EF.

NHibernate is also a very good solution, and it does have LINQ providers, so you might want to investigate that too (if for no other reason than just to be well informed). But for me, I need to stick to 'official' Microsoft solutions.

Coding Gorilla
Thanks, the Entity Framework is nice to work with and provides more flexibility with mapping objects to multiple tables etc. It seems the more appropriate choice for our project so we're going to give it a try and then compare with other projects that have been done using NHibernate.
Winger
A: 

I think that Entity Framework is the MS recommended solution. NHibernate has a learning curve that you would need to get past, but probably the most feature rich ORM for .NET. EF however is just easy, drag your DB objects over and boom, you have the data access classes to work with!

Dustin Laine
NHibernate has visual designers.
Michael Maddox
A: 

I have tried all 3 ORM NHibernate, LINQ to SQL and Entity Framework 4. I blogged about my experiences on my blog at http://nileshgule.blogspot.com/2010/09/entity-framework-learning-series.html.

I think NHibernate has many advanced features but it suffers many time from a typical open source problem. It lacks good documentation and making simple things work for you might take few days. LINQ to SQL was Microsofts first forey into ORM world. Going forward its quite obivious that they are going to deprecate the SQL server specific LINQ to SQL technology. Hence choosing Entity Framework 4 would be a good option. I have summarized some of the differences between LINQ to SQL and Entity Framework 4 in my blog http://nileshgule.blogspot.com/2010/09/entity-framework-part-2-comparison.html

You can also refer to a very good video series by Julie Larman which are available at http://msdn.microsoft.com/en-us/data/ff191186.aspx

Nilesh Gule
EF 3.5 and EF 4.0 are very different. EF 4 is not an option for the person asking the question.
Michael Maddox