I usually refrain from making posts that just end up referencing the work of others, but while looking for something else I just came across two blog posts from late-November of 2008 where Davy Brion goes into some detail about how to use stored procedures with NHibernate to both retrieve and instantiate a mostly-flat object (one without a terribly-deep object graph) and also more complex objects that hold collections of other objects.
In the time both during and since my Summer of NHibernate screencast series where I touched briefly on how to use SPROCS with NHibernate, I’ve fielded questions from several viewers and readers about getting further references about techniques for how to do this. While I tried my best to point people in the right direction, I’m sure I wasn’t really able to be as helpful as I’d liked since I have little experience (thankfully!) working in an all-sproc, DBA-Nazi-controlled data environment.
But for those that are both interested in using NHibernate and constrained in a SPROC-only world, here are two posts that pretty succinctly demonstrate some of the techniques that you will need to consider mastering to make this work…
I still hate SPROCs by Default
For the record, I’m still philosophically predisposed against mandating the use of sprocs for all database interaction because I pretty strongly believe that its a false ROI in all but some of the more complex server-side manipulation cases, but in case you find yourself trapped in such a scenario and still want to use NHibernate, these posts will certainly give you some idea of how to approach getting your work done.