An interesting recent development is the explosion in tiny ‘object relational mappers’, such as Dapper, Massive or PetaPoco. Most of these help you with a thin layer to read data from a relational database, but don’t try to ‘simulate’ a pure object model. For example they use SQL as query language and don’t manage complex object graphs.
Why are these libraries showing up now? I think one reason is that C# has now the features to actually write these kinds of tiny libraries. Mainly because features like dynamic, closures, etc. allow a more functional and concise way to express such things. Of course in some sense they play catch up with other libraries for other languages. When I look at these libraries they remind me of my PHP projects, where I had a very similar library.
I like really like these frameworks, because they remove the annoying boiler-plate code, but don’t try to create a complex abstraction, which is leaky anyway. The only thing I’m really missing is LINQ. Of course even the simplest LINQ provider would be much larger than the mini ORM itself and add a lot of complexity.
Currently I’m not working on any project with relational databases, so I can’t tell much more. When such a project comes along, I will certainly look at these libraries again. And of course these mini frameworks are just another tool, not a magic shiny unicorn =(.
- History of a Mixtape
- Secret Agent Miss Oh