views:

5391

answers:

24

I'm writing an application from scratch, I am not pretty sure which one to use.

  • Microsoft Entity Framework
  • NHibernate
  • Gentle.NET
  • Other

Any guidance or opinions on the advantages and disadvantages of each would be helpful.

+2  A: 

I've had good experiences with LightSpeed.

James Newton-King
+4  A: 

NHibernate allows to use POCO files which makes reuse of your existing object model very easy. it als has some advanced features like several caching levels, experimental linq support, etc...

Joachim Kerschbaumer
and its open source
Miau
In NHibernate you have to adjust your object model when you want lazy-load. Your properties must be virtual.
Patrick Peters
+6  A: 

LightSpeed is very good and we have had success with it in the past.

I would not recomend LINQ to SQL as it is tied to SQL Server and only supports Table Per Hierarchy.

Use Entity Framework or NHibernate if you cannot dish out the extra cash for LightSpeed. NHibernate has a learning curve though while with Entity Framework you are good to go. NHibernate supports POCO objects, so if you already have an object model in place, NHibernate is the way to go.

SharePoint Newbie
Well Linq to sql is currently tied to MS-SQL but you can right other providers for it can you not? maybe the mysql guys might include it in the next .NET Connector :P
Sekhat
Lightspeed can choose to provide its own LINQ provider if it could.
Jon Limjap
A: 

In answer to Bernie: I assume you are meaning Linq to SQL. That is mainly meant for RAD purposes, on the other side Entity Framework is probably what MS intends for enterprise development.

But I would also strongly consider going for Microsofts stuff, unless there was some features in the existing frameworks that are needed for the project at hand.

Bjørn
I would strongly consider going the most stable and correct tool for the job. Microsoft != best choice to use.
Sekhat
I also suggest going with NHibernate at the moment. I'm developing a project with NH at the moment and it works absolutely perfectly
Tigraine
+1  A: 

Another open source option, by the way: Subsonic

http://subsonicproject.com/

Bjørn
A: 

I use the Flixon Site Generator extensively. This has similarities with EF as it creates a rich domain model (including many-many relationships) and is structured as loosley coupled layers (UI/BLL/DAL) etc... basically, you just point at your SQLServer (2005 and above) database and hit the OK button - that's simplicity for me!! As it's patterns based, it's pretty simple to get to grips with the architecture as well.

There's info and a version to be found here:

http://forums.asp.net/t/1318180.aspx

+3  A: 

We use EntitySpaces with MyGeneration for code generation and find it to be great.

Martin
+1  A: 

I've tried a few (even written one) and found nHibernate to be by far the best and the easiest to use in real world situations (where linq to sql falls flat on it's face).

flukus
+9  A: 

Off the top of my head:

  • NHibernate - Which I have experience using and I feel is best for most purposes, but then I'm biased. Open source port of Java's Hibernate.
  • LLBLGen - Full fledged ORM by Frans Bouma.
  • Subsonic - open source project led by Rob Conery. Great for smaller scale projects, at least until LINQ to SQL came along (very subjective opinion!).
  • Microsoft Entity Framework
  • ObjectMapper.NET
Jon Limjap
Best advice for using an ORM, use any well matured and supported one that you like and have active user communities. The above list are the big ones worth considering. +1 NHibernate
Brendan Kowitz
+6  A: 

We use NHibernate, mainly because:

  • It supports other databases, in our case Oracle. Linq to SQL and EntityFramework support only SQLServer out of the box
  • Use of POCO objects. You don't need to put any attributes or other markup inside your class.
  • Many side projects. There is for example one project (Fluent NHibernate) that replaces the mapping xml file with a class implementation, or an Linq implemenation for Nhibernate.
LINQ to SQL only supposts MS SQL Server, but Entity Framework works with most databases you can access via ADO.NET.
Chris Charabaruk
+1  A: 

We use iBatis. It is simple and lightweight enough to do the job without bringing too much complexity and overhead to the project.

duckworth
+3  A: 

$$$ Ideablade DevForce
[http://www.ideablade.com/DevForceClassic/DevForceClassic_overview.html]

$ DevExpress XPO (Express Persistence Objects)
[http://www.devexpress.com/Products/NET/ORM/]

Both of these cost money. In their proportions, each is worth what you'll pay.

If you are broke and have more time than money, try SubSonic.
[http://subsonicproject.com/]

Ideablade is the enterprise and n-tier tool, capable of creating entities even from services, as well as views and stored procedures.

DevExpress XPO is quite robust.

Both Ideablade an DevExpress tools easily connect as data sources to controls Microsoft and 3rd party tools.

SubSonic seems to have many comparable characteristics of the expensive tools, but any new user will "pay" days and weeks before they learn it. The documentation exists of trial and error, syntax help, and forums on the web site. Compared to the other tools, it's like working in the dark.

Sometimes "free" is very expensive.

If you have a client who is paying for your time, IdeaBlade can be worth a month of work. DevExpress can be worth weeks. I'm sure SubSonic is good, but without a trusted guide to teach you, it will be a long time before those efficient benefits are derived.

Good luck on your choices. They will be like a crown or an albatross.

+3  A: 

Since nobody mentioned it yet, I just want to throw in Genome.

I have worked on a "big" successful project (multi-million, several years, >10 developers) for which we chose Genome as persistence solution.

Of course this has been some years ago, when ORM in the .NET-space was a relative new thing.

I was responsible for the data-access of the project, and Genome left a very neat impression. Today I am working a lot with Hibernate in the Java-space, and from a developer standpoint Genome seemed way more intuitive (even though it has a different architectural philosophy and therefore cant be compared directly).

Genome is a commercial product. Genome has evolved a lot. Today it claims to be fully LINQ-compliant. If I would be in a position of evaluating a ORM-solution for .NET I would definitely look at Genome again.

Another commercial product, not mentioned yet is Telerik Open Access (formerly Vanatec Open Access).

jbandi
A: 

I have a good experience with LLBL, its easy to configure and very easy to code with.

Also you can find list of most known .net ORM tools

Amr ElGarhy
+4  A: 

I've been using NHibernate (and Active Record) for some time, and I must admit it has it's flaws. It seems like the architecture is quite old making new features like LINQ support quite hard to implement. However, the team behind is very fast to answer any questions and the community is very supportive.

Recently I have been working with LINQ-to-SQL and it too has it's flaws. Of course the two can't really be compared, but for what it's being used for, I can see that LINQ-to-SQL resembles Active Record quite a lot (perhaps because of the fact that the key developer behind Active Record actually developed LINQ-to-SQL).

What I don't like about LINQ-to-SQL is that it's so hard coupled and "almost" impossible to test/mock. Furthermore the part of not having complete control over the domain model also makes me a bit uncomfortable. At the moment I'm doing a lot of mapping between the actual domain model and the LINQ-to-SQL model. At this point NHibernate really shines. Having very little restriction put on the actual domain model makes it a very powerful tool, but apparently this "restriction" makes a lot of people upset blaming the tool for not being completely PI - but neither is Entity Framework, LINQ-to-SQL, iBatis, OpenAccess or any other ORM for that matter.

I have a lot of ORM's to try out, but so far NHibernate have never failed me (and if it did, I'd know that any other ORM would too).

TigerShark
A: 

Here are opinions on DevExpress XPO: http://stackoverflow.com/questions/31559/any-thoughts-on-devexpress-xpo-orm-package I personally would choose NHibernate.

Przemaas
+1  A: 

EntitySpaces http://www.entityspaces.net

Mike
already mentioned...
Russell
A: 

I'm suprised that no one mentioned the best ORM out there:

Your own!

The best thing about Your own! ORM is that you can implement something interesting that you see in other ORM tools. I do this approx once a year. And if something bothers you, you can either ignore it or change it. The choice is yours and only yours.

Vnuk
I find it really funny that people have the urge to down vote this answer, and doing so without any comment.
Vnuk
Voted back up one, because this is exactly what I've been doing for several months. Unique situation, where we have a large and complex existing data model, developed on SQL Server, but the database has been ported to Oracle and the code base has to run with either DB. Writing your own ORM does let you choose an archiecture that can avoid a lot of the performance issues with generalized ORMs. However, this should NOT NOT NOT be your first experience with ORM! I've used LINQ to SQL and Entity Framework previously.
Cylon Cat
I should really mention that I started with my own ORM in 2002 (in VB6) without any previous ORM experience. If you think back, Codesmith wasn't available back then, and I wrote my own templated code generation tool. Come to think of it, which of todays ORM's were available in 2002?
Vnuk
ORMs available in 2002? Pretty much none, as far as I know. The difference now is that good ORMs are available, and will be sufficient in many situations. Plus we can learn from them, and know their weaknesses as well as their strengths. But if existing ORMs don't meet your requirements, then custom code is still the answer.
Cylon Cat
There is always a risk in "roll your own," too. It may make perfect sense to *you*, but does anyone else know how to use it or maintain it? There is some intrinsic value in choosing a solution that is documented/supported/etc. It's similar to the cost of maintaining/repairing a Ford truck vs. a Bugatti Veyron.
Todd
+3  A: 

I personally use LightSpeed now and I also used Subsonic. Lightspeed development is very active, the forum and support is great! I received very fast answers from Mindscape.

There is a great performance benchmark for .NET ORM:

http://ormbattle.net/

LightSpeed, NHibernate, SubSonic, OpenAccess, Entity Frameworks are evaluated for their perf with Linq, Crud operations, etc.

crou
I liked Lightspeed enought to pay for a license with my own money, but buyer beware: Lightspeed has performance problems that don't show up in ORM battle's relatively simple tests. These problems include:> Entity materialization exponentially degrades when using LINQ join statements.> Cache is ignored when working with LINQ queries.> Executed T-SQL fetches all columns for all tables, even when using LINQ projections (a big no-no!).Also, calling code cannot assign primary keys to new or existing entities (unless you hard coded a bypass on each entity).
Mark
+1  A: 

I use XmlDataMapper a simple free ORM and sometimes EF.

Binoj Antony
A: 

I've used Telerik's OpenAccess ORM in several commercial products, and it is definitely my ORM of choice. I developed my OpenAccess chops while an employee of Telerik two years ago but have since tried other ORM products, including LINQ to SQL and Entity Framework, in projects I've worked on for other employers since then. OpenAccess is very easy to use - it supports multiple database platforms (including Oracle), rich LINQ support, forward & reverse mapping, and integration with Visual Studio. It's very fast and has enough flexibility that you can let it do all the heavy lifting, or you can dive in and fully customize the way your objects are mapped and loaded.

Oh yeah, and it's Express version is free if you're developing against a free database platform (SQL Server Express, Oracle XE, etc).

Kevin Babcock
A: 

Jon Limjap's answer was great, so I won't reiterate (already plenty of that in here.)

I'll take a different tack, and recommend Entity Framework v4. I like NHibernate, SubSonic, and LightSpeed, they are all good products. However, something that EF has that they don't is the sheer force of Microsoft behind it. That means broad availability and familiarity amongst the large pool of .NET developers, as it follows the well-established API patterns of the rest of the .NET framework. Now that .NET 4 has been released, in a few years EF will be an ORM force to be reckoned with, and will be a pervasive presence amongst all of their data-centric products and frameworks.

jrista
A: 

Our team has been using Telerik OpenAccess for about 4+ years now and are very happy with it. The system is based on a set of WCF services which (through a couple of other layers) manipulates our persistent class model. So no direct contact with the database is required. The thing I like about OpenAccess is that it is so flexible. For example for basic operations you can choose the "standard" way to do manipulation of persistent classes (ORM performs SQL queries against DB to manipulate). But we also have several very complex search queries, where we thought it might be better to use Stored Procedures.. OpenAccess handles this smoothly.. it even gives you back persistent objects from the stored procedures. Another thing is the built in Level 2 cache (of persistent objects), which of cause both works in a clustered and non-clustered environment. It had a huge boost in performance on our system...and that was on a system that already met the performance scope defined for the project. I could go on and on about the feature set... I have used several other ORMs for .NET (third party and Entity Framework) and I found OA to be the most comprehensive suite available.. There's simply nothing you can't do with it. It helped us a lot in getting rid of cumbersome CRUD methods in our DAL because you work with a persistent object as with any other object in .NET.. Even for our highly complex queries we found it to be a good match because of the flexibility. And of cause... there's the well-known outstanding quality of Telerik support included :-)

Henrik Gøttig
`But wait...There's more!` Everytime I see someone post about a Telerik product, it sounds like someone who works in the marketing department at Telerik.
Robert Harvey
Well Robert, I am MVP in the product, so I might be a little "colored" in my opinions.. But hey, I am not religious. Anyway, I worked with many different ORMs during the years. Still I found OpenAccess to be one that has the best feature set. But as always... it depends on what your need is.
Henrik Gøttig
A: 

I recommend to you compare ORM by the following criterias:

  • Model building speed
  • Productivity
  • Cross-database support

The first criteria means how fast you can build your one-to-one copy of the database. Read more about second criteria on the ORM Battle resource. The third criteria means that you can use your ORM with the different database servers without business-logic changing.

As for me, usually I'm using Devart LinqConnect. I have LINQ to SQL functionality with it, and use MySQL and Oracle simultaneously.

JackD