18.12.08

Perhaps NHibernate Mapping attributes are poisonous

I have spent the best part of a working day experimenting with using NHibernate atrributes after starting off with .hbm.xml mapping files.

The result is a domain model that's very NHibernate aware, I cannot reuse the model without there being a whiff of NHibernate. This being the case, I have decided that xml mapping files are probably the way forward. I am aware of other mapping approaches, but perhaps, the verbosity and loosely coupled approach of mapping files has its advantages.

Yes attributes and mapping approaches use a declarative style, but one can not help feeling that embedding persitence crosscutting concerns in domain model could cause grief further down. Mapping files, you have a new friend.

No comments: