I like the idea of writing mappings in code for sure. And, your code sample certainly looks very readable to me :) Nice.
Agree with James in that good validation up front would be a huge bonus. The fact that it mirrors the XML is a very good thing from a learnability point of view. It's DRY too (one set of terms for 2 mapping approaches). I imagine you could use an XSLT translation to convert XML mappings to this new code version. All the existing documentation could then be updated to show samples for both approaches. This would make for a smoother documentation effort :) I'm also thinking about NHibernate in Action 2, if anyone ever gets it started :S I also like the idea that this could be a useful core feature, upon which the community to build their own DSLs. My 2p worth. On Jan 13, 6:08 am, Fabio Maulo <[email protected]> wrote: > Hi team. > > I would like to have a code re-view of my last post and > a constructive > feedbackhttp://fabiomaulo.blogspot.com/2010/01/map-nhibernate-using-your-api.... > > <http://fabiomaulo.blogspot.com/2010/01/map-nhibernate-using-your-api....>The > post, and overall the code, is basically an example about how implement a > custom API to create mappings by code. > That is an invitation to everybody want create his own API and even an > invitation for FNH team to use the Hbm* classes instead generate XML. > > That said, seeing how things are going in each framework, NH needs its own m > apping-by-code. > Two matters here: > 1) API definition > 2) usage of Hbm* or directly create metadata (classes of namespace > NHibernate.Mapping) > > What is clear is that our implementation will supports anything supported by > XML and, probably, we will improve some of actual "conventions-interceptors" > (as, for instance, INamingStrategy & Co. ). > > -- > Fabio Maulo
