10. March 2011 23:10
After .NET 4.0 came out I read all about the new cool stuff in it and filed as much of it into the back of my brain as I could. I saw the new dynamic keyword, and thought “oh, that’s kinda cool”, but that’s about where my thought process ended.
A few minutes ago I read about Massive, which is a super simple ORM (really, it’s not an ORM… more like a relational converter, since the “objects” don’t exist until the data comes back) which takes advantage of dynamic typing to produce strongly typed domain objects from almost any database. Notice I said produce rather than generate. This isn’t a code generator we are talking about here. Thanks to dynamic, it doesn’t need to be.
At its core, Massive takes the LINQ queries that we all know and love, executes the appropriate queries against the database (via built in ADO.NET libs from System.Data.Common), and then it does something special. It takes the resulting DbDataReader, examines the meta data associated with that reader, and creates – on the fly – a strongly typed class that represents that data via a dynamic type.
Below is a code sample snagged from the above referenced blog post:
That super simple chunk of code is what turns a DbDataReader’s result set into a strongly typed domain object. That, my friends, is freaking awesome.
When I realized how this guy was using dynamic types, I had a “whoa” moment. I love those moments, because unlike filing stuff into the back of my brain, a whoa moment almost always results in a change in the way I approach programming problems. This whoa is perhaps on the same level as the whoa I had when I saw my first lambda expression. This is good stuff.
28. July 2006 10:35
The ADO.NET Entity Framework is Microsoft's entry into the rapidly growing ORM market. It allows developers to concentrate on their business logic and not worry about data access or maintaining a brittle data access layer that is heavily dependant on the database schema.
Pretty nifty stuff, especially when combined with LINQ. Most of this stuff is not new, but it's definitely a welcome addition to the .NET Framework.
read more | digg story