I ran across this post by Ayende and it pretty much sums up where I want to reach with my persistence ignorance efforts:
“After that, you are done. Just create an entity in the proper place, hit the /database/create and have a lot of fun.”
I of course like the fun-part of the quote the most. :) But seriously – that what I want to reach – to configure my conventions. And then simply code the model as I want it and let the framework (NHibernate in this case) figure out how to store it.
Well, as it seems, the Fluent NHibernate framework has been updated since the Ayende post. So I’ve read, and read, and read and discovered some shortcuts. By the way – here is an article on how to make the transition from the “old” convention-style into the new.
I have put together an updated sample for what Ayende did in that post above. I also added a feature to be able to automatically set cascades for OneToMany- and ManyToMany-relationships.
Here is the most important parts of the code.
**[UPDATED] **Here is the complete sample.
Did I mention that I LOVE Fluent NHibernate? Well I do!