Reputation: 35679
I've just refactored my application to get rid of a domain object layer because it was causing NHibernate's lazy loading to break - I spotted this using NHProf and put the blame on AutoMapper.
I've seen others have similar problems. So applying YAGNI I decided to get rid of the DTO layer all together and just have the one set of domain objects - makes sense to me.
However I had a couple of properties on my domain objects that don't exist on my mapped objects. I've moved these to my data layer mapped objects but am now getting NHibernate errors because they aren't virtual.
I don't really want them to be virtual do I? These are either just Getter properties operating on the other mapped properties or set in the business logic.
Anyone have any ideas? Google is not helping.
Upvotes: 2
Views: 951
Reputation: 35679
Seems I should have tried setting them as virtual.
Lesson learned, even if you're not mapping properties on NHibernate objects, set them as virtual.
Upvotes: 3