This post is the is part of series of posts covering the various microORMs in the .NET world. I intend to look at how each microORM meets certain data access and manipulation needs. The current series includes,
I've been playing, somewhat superficially, with a few MicroORMs in .NET for a while now. While I have yet to use any in a real project I wanted to do a bit of comparison series. It's a bit selfish I guess as I am actually writing this series as a means to get myself up to speed on these frameworks as well as inform others about perils I faced as a newcomer to them as and when I hit those pain points.
To be honest I've never been a fan of the Data Access layer in projects - Databases are fine I guess and the application layer is all good but that thin layer between the two just frustrates me. It's often needlessly over complicated, confusing, hacked together or just plain broken. Most of my experience is with iBatis/MyBatis and it "does the job" but its very fiddly and XML configuration becomes cumbersome for simple tasks. I've also tinkered with other things like Entity Framework and NHibernate but more often than not they just don't feel right.
This make microORMs sound appealing to me for the very same reasons. They give you just enough to get the job done, prefer convention over configuration and generally allow you to get right down to the metal and tweak things using SQL - easily the best DSL for working with databases. Sure they may lack many features but typically these are features you wouldn't really miss if taken away from you.
The MicroORMs
There are a number of ORMs currently available for .NET and I am going to look at a few of them in terms of features and syntax.1
Dapper
Dapper was created by Sam Saffron from Stackoverflow. Rather than a library Dapper is a single file that you can drop into your project and applies some syntactic sugar to extend your IDbConnection interface.
Massive
Like Dapper, Massive is a single file rather than a library and offers a very similar feature set to Dapper except it works exclusively with the .NET4 dynamic
stuff.
PetaPoco
PetaPoco came out of inspiration from Massive and has extended to support real objects as well as some very nice extra features such as T4 templating, configuration via model attributes and other nice stuff.
Simple.Data
Simple.Data is A lightweight, dynamic data access component that make use of convention and dynamic
to allow users to access database tables via dynamically generated methods.
ORMLite
ServiceStack.OrmLite is a convention-based, configuration-free lightweight ORM that uses standard POCO classes and Data Annotation attributes to infer its table schema.
On with the show
So thats my toys all laid out and ready to be played with. Next step is to look at some of the typical operations for selecting and manipulating data from our database. I hope to have the first real part of this investigation up shortly (or before the decade is out at least).
1 This list is not exhaustive there are a few specialised ones around as well which I may touch on later in the series.