NHibernate's Mapping by Code - first impressions

added by notherdev
1/5/2012 8:24:26 AM

7 Kicks, 370 Views

NHibernate's 3.2 new mapping-by-code feature allows to completely remove XML mappings from NHibernate's pipeline. I'm pretty used to using Fluent NHibernate, but I always think of it as the only replacement for plain hbm.xml mappings, that are just too clumsy and too verbose. I like FNH's fluency and clarity, but I think it's far from being ideal solution. Mapping by Code from NH 3.2 seems to be promising alternative.


3 comments

dpeterson
1/5/2012 8:25:18 AM
I ran into a similar problem trying out entity framework code-first. There's very little good, up-to-date documentation on it, and many of its shortcomings are not publicized. I've used FNH on projects before and I would really like to see some sort of resolution there, I'd hate to see it disappear as an option moving forward.

notherdev
1/6/2012 4:59:42 AM
I've experimented with mapping-by-code a bit and written a naming convention that is aimed to resemble Fluent NHibernate's default one, which is pretty good - see another blog post about this: http://notherdev.blogspot.com/2012/01/mapping-by-code-naming-convention.html

vijayst
1/6/2012 10:08:26 AM
I have tried Entity Framework CodeFirst - mostly for simple applications. It works good for me.