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.
I'm writing an application from scratch, I am not pretty sure which one to use.
Any guidance or opinions on the advantages and disadvantages of each would be helpful.
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...
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.
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.
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:
We use EntitySpaces with MyGeneration for code generation and find it to be great.
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).
Off the top of my head:
We use NHibernate, mainly because:
$$$ 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.
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).
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
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).
Here are opinions on DevExpress XPO: http://stackoverflow.com/questions/31559/any-thoughts-on-devexpress-xpo-orm-package I personally would choose NHibernate.
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.
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:
LightSpeed, NHibernate, SubSonic, OpenAccess, Entity Frameworks are evaluated for their perf with Linq, Crud operations, etc.
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).
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.
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 :-)
I recommend to you compare ORM by the following criterias:
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.