Note: This project is in the early phase, and is very much a work in progress. If you would like to help or have a better way of using a given ORM to satisfy a requirement, please contact me at slsys.net (kevinw -at-) (slsys.net).

ORM Smackdown

Overview

Project Description
ORM Smackdown compares and contrast different ORM technologies used on the .NET platform.

Project Objective
The objective of this project is to demonstrate how different ORM's work, as well as their strengths and weaknesses. These demonstrations will be done using the same database schema and the same object model (if possible) with different ORM's and different RDBMS engines. Although our Schema is fairly trivial, it does represent some non-trivial scenarios of mapping objects to relational storage.

Background
This project was started as a research and learning experience. In 1997, I created my first code generator, a Visual C++ console application to generate strongly typed wrappers in C++ to use OLE-DB to call stored procedures. This product was called "ProcGen" and saved countless hours and bugs. Over the next ten years, I've built dozens of code generation templates that have been successful. Today I have a pretty good process for creating advanced and powerful DAL's (Data Access Layers).

My view on ORMs was that although they provided some very nice features, there was a cost for breaking the 1:1 relationship between the objects and the tables. Since the generated DAL's I were using did at least what 90% of what most ORM's did, the cost in terms of additional complexity of an ORM just didn't justify the price for the additional 10%.

There are a lot of people a lot smarter than I am using ORM's so I figured it was time to bring myself into the 21st century and see what all the fuss is about. Picking an ORM technology should not be done lightly. I would expect just like anything else the more you use a technology the better you use that technology so my goal is to detemine what I'll hopefully be using for the next 10 years.

The ORMs

The following ORMs are be compared:
  1. Microsoft Entity Frameworks
  2. NHibernate
  3. Linq to NHibernate
  4. Subsonic 2.2
  5. Subsonic 3.0 - Pending Beta Release
  6. Raw ADO.NET
  7. ADO.NET Typed Data Sets
  8. Linq To SQL
  9. LLBLGen
  10. Lightspeed ORM
  11. ??? If you don't see your favorite ORM here, let us know and get involved!

The ORMs in bold have a default implementation and are ready for feedback

The RDBMS Engines

The ORMs are configured to work against the following relational database engines, where ORM providers are available:
  1. Microsoft SQL Server
  2. Oracle
  3. MySql
  4. SQLite
  5. Microsoft Access

The Criteria

The following areas are reviewed and compared:
  1. Effort involved with configure the mapping the object model to the relational model
  2. Learning curve for performing the mapping
  3. Tooling available to configure the mapping
  4. Capabilities of an ORM:
    1. How much flexibility is there to map a different Object Model to a RDMBS Schema
    2. Ability to automatically fix-up foreign keys
    3. Transaction management
    4. Ability and Mechanism to load associations to other objects
    5. tbd
  5. How much of a learning curve will there be with junior developers manipulating the objects
  6. Comparison of the SQL that is Generated, are there any performance impacts
  7. How and How much memory is utilized
  8. How active is the project being enhanced and supported.

The Relational Model

The following Relational Database Model will be used to study the different ORM's:
Schema.png

The Object Model

We will be attempting to use the ORM's map schema to an object model that is similar to the following:
ObjectModel.png

Whereas:
  1. User is a type of Person
  2. A User has 0 to many Portals
  3. A Portal has 0 many Users
  4. A Portal has exactly one Administrator and is a User
  5. Contact is a type of Person that has exactly one Company
  6. User has exactly one Manager that is a User
  7. A Person has exactly one Role
  8. A User has 0 to many Addresses
  9. A User has 0 to 1 Default Address

Last edited Jun 27, 2009 at 2:56 AM by kevindwolf, version 29