Archive for ORM tag
What I’m up to at the moment
The project I’ve been working on professionally for the last two years reaches a milestone this week and so is a great opportunity to take a well-deserved break for a couple of weeks.
I was hoping to head out somewhere as far out as Japan but things are held up in a complicated set of scheduling dependencies and a looming demo to investors.
At home I’m currently working my way through Microsoft .NET Framework 2.0 Windows-Based Client Development Training Kit (nice name there Microsoft) as part of my studies towards exam 70-526. This is a requirement to obtain a Microsoft Certified Professional Developer (Windows Applications) which I’m hoping to add to my resume.
The initial test they provide on the CD-ROM wasn’t too tricky however some of the questions seem rather obscure and irrelevant. This is apparently quite normal for Microsoft exams and does seem to be a little familiar when I think back to my Internet Information Services 4.0 examination I took in 1999 to get my Microsoft Certified Professional certification.
I’m also finishing off a few additional icons for AnkhSVN particularly in the area of the Working Copy Explorer and the Repository Explorer dialogs. Once I can get the Subversion 1.4/APR/zlib dependency libraries etc. installed again then I’ll be able to test and commit those back. I’ll bug Arild to put the 1.4 dependencies up on Tigris for other people wanting to hack around with the source too.
GrinGod and myself have been considering writing a small blogging system in .NET using the SubSonic ORM. I’ve been tempted for a while and today Phil Haack, maintainer of Subtext, dropped the clues that he’s also wanting to switch Subtext to an ORM although would like to do it very slowly.
I, on the other hand, am quite keen for a very lightweight free .NET based ORM that doesn’t provide UI based configuration or skinning abilities instead relying on the developer to get his hands dirty for customisation. More of a .NET blogging system for .NET developers who want to integrate it with whatever they’ve rolled for their site.
And it seems we can borrow all sorts of stuff from the Subtext source tree.
[)amien
Choose your ORM: Runtime, code generation or build provider?
Selecting the right object-relational mapper is a tricky decision with many factors to weigh up.
One of the basic decisions is whether to go with a dynamic runtime (“black-box”) or a code generator.
I’m not a fan of the runtime approach – the discovery at runtime negatively impacts performance as it often uses reflection (or failing that post-compilation byte code modification) whilst robbing you of compile-time checking, IntelliPrompt support against your database objects, deployment and potentially licensing issues. In effect, it’s not that much better than a typed dataset.
Code generation provides for a much finer granularity letting you tweak the templates for the performance and features you need whilst also providing full compile-time checking and IntelliPrompt support.
Tools such as CodeSmith (my personal favourite), MyGeneration (free) do a good job of letting you write these templates and create the necessary ORM code but require being re-run every time you change the schema. During the starting phases of a project this could be quite often and goes against the whole concept of RAD.
So step in SubSonic and it’s build provider approach.
The idea here is that you modify your .config file to include the SubSonic build provider and it’s connection string, drop a simple text file in that lists which tables to work with and you’re done.
SubSonic now goes off to your database via the connection and generates all the code for tables you need and it’s magically there to be used like any other classes. Check out the demo to see just how easy it is.
SubSonic supports a large number of databases, has support for Enterprise Library, is open source and also provides simple “scaffold” pages that let you throw a basic web add/edit/update/delete table maintenance page by just throwing a table name attribute onto an empty page’s form element.
The only downside at this point is that it uses the ActiveRecord pattern for the ORM. If I manage to get some time to spend with it and can knock up a Domain Object + Data Mapper version I’ll let you know.
[)amien