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 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 following ORMs are be compared:
The ORMs in bold have a default implementation and are ready for feedback
- Microsoft Entity Frameworks
- Linq to NHibernate
- Subsonic 2.2
- Subsonic 3.0 - Pending Beta Release
- Raw ADO.NET
- ADO.NET Typed Data Sets
- Linq To SQL
- Lightspeed ORM
- ??? If you don't see your favorite ORM here, let us know and get involved!
The RDBMS Engines
The ORMs are configured to work against the following relational database engines, where ORM providers are available:
- Microsoft SQL Server
- Microsoft Access
The following areas are reviewed and compared:
- Effort involved with configure the mapping the object model to the relational model
- Learning curve for performing the mapping
- Tooling available to configure the mapping
- Capabilities of an ORM:
- How much flexibility is there to map a different Object Model to a RDMBS Schema
- Ability to automatically fix-up foreign keys
- Transaction management
- Ability and Mechanism to load associations to other objects
- How much of a learning curve will there be with junior developers manipulating the objects
- Comparison of the SQL that is Generated, are there any performance impacts
- How and How much memory is utilized
- 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:
The Object Model
We will be attempting to use the ORM's map schema to an object model that is similar to the following:
- User is a type of Person
- A User has 0 to many Portals
- A Portal has 0 many Users
- A Portal has exactly one Administrator and is a User
- Contact is a type of Person that has exactly one Company
- User has exactly one Manager that is a User
- A Person has exactly one Role
- A User has 0 to many Addresses
- A User has 0 to 1 Default Address