1

Following on from this question:

NHibernate: Lazy loading of IUserType

Seeing as I can't lazy load a property or a one-to-one relationship, is there a way I can use an IUserType with a many-to-one? Something like this (which doesn't work):

<many-to-one
     name="Client" column="`ClientId`"
     lazy="true"
     type="EmployeeSystem.UserTypes.ClientUserType, EmployeeSystem" />
Community
  • 1
  • 1
Paul T Davies
  • 2,527
  • 2
  • 22
  • 39

1 Answers1

0

Looks like NHibernate does not support custom loading (IUserType) for associations (many-to-one, one-to-one etc). As a side note, lazy loading with one-to-one is possible, but again there is no way to put the IUserType hook. I think you were on the right track with lazy properties. Update the original question with the code that shows how you load Employee.

Community
  • 1
  • 1
Dmitry
  • 17,078
  • 2
  • 44
  • 70
  • Yep, it can't be done. Looks like another dead end. NH can be frustraing sometimes. My current route is to create a proxy in NullSafeGet with an interceptor that loads the entity from the service when any properties other than ID are accessed. – Paul T Davies Sep 05 '11 at 15:46