Anonymous wrote:
Right. I understand that the attributes are unintrusive, but they still require a reference to the dll and using statement in all my POCOs. This is a violation of the Dependency Inversion Principle. It means I can't build without NHibernate or NHibernate.Mapping.Attributes. I'd like a DLL containing all my domain classes that has no external dependency.
KPixel wrote:
You have to add a reference to NHibernate.Mapping.Attributes.dll (not NHibernate.dll)!
As far as I know, neither NMA or AR (or NHibernate for that matter) was explicitly designed using DI. Also, DI doesn't help when you need to use interfaces in the dependent assembly. DI is about object dependencies, not assembly dependencies. You could load objects by reflection, but attributes won't work that way.
If you want an attribute-based mapping solution that you don't have to write yourself, you have to reference an external dll of some kind. Otherwise, you have to do the mapping yourself. I know of no other solution.
Seems like a very expensive requirement. What is the reason for it? License issues?