I’ve been mostly asleep since Saturday evening trying to get over some grunge my son brought home from Sunday school daycare last week. Ugh. Thankfully I got mostly over it before my wife had to leave on her regular biz travels, so I’m semi-coherent and able to try and knock off some more things with NHibernate and the project I’m working on. (Dude, you’re not coherent when you’re in good health! — ed.)
James pointed me to ObjectMapper as a tool which might help me resolve some NHibernate mapping issues I’ve run into with many-to-many relationships. ObjectMapper gives you the power to do various reverse-engineering tasks: from database to model, from assembly to classes, from classes to tables. All of that, in either direction. Pretty slick.
ObjectMapper won’t let you work backwards from existing .NET 2.0 assemblies, but that’s not a show-stopper. I’ve been working from my existing database model, generating up to classes and then having ObjectMapper generate mapping files for NHibernate. One hitch to using NHibernate and ObjectMapper is that you need to get all the relationships done at once before you start using any access points. I’m working on a DB schema with 12 inter-related tables. (No, they don’t all tie to each other in a spaghetti-like mess!)
I think you can get around this by leaving out the <bag> or <set> elements you use to define inter-entity relationships; however, now I’m running into odd schema errors with <id> elements being out of place. I’ll blog on that solution once I figure it out.
NHibernate seems like a great thing, but it’s certainly a huge PITA to get up and running. Unclear documentation and rudimentary examples aren’t a big help.
Now Playing: Sheryl Crow — Steve McQueen. It’s only three songs, but Steve McQueen has a killer beat to it. I first heard this at a 3D remote control helicopter competition at the National Remote Control Modeler’s Museum in Muncie, IN. A female pilot fired up this music, launched her ‘copter, and did amazing tricks for about five minutes — with the ‘copter rarely climbing more than five or ten feet above the ground. I was there with my Dad and daughter, so this short disc brings back great memories.