I've been looking at loading enities from WCF:
NHibernate: Lazy loading of IUserType
NHibernate: Many-to-one IUserType
Preloading IUserType with values from webservice
I've worked out how to lazy load the entity from WCF: you have to create your own proxy which calls WCF and return it from IUserType, but I'll blog this at some point.
My question now is, can I part load an entity from the database in the usual way, so some properties are populated (ones that are stored locally) but for other properties, it has to call WCF? The local properties are ones that might be searched on, or returned in a query (Can't call WCF for each one - would be too slow), and the others would be called if the system needed to perform some business logic on it.
The problem is that I don't think I can use IUserType here, because I would need to use bag/set for my collections as I would want them to be eager loaded. Is there any way this can be done?
Edit:
It would be ideal if I could force NHibernate to return a proxy, and some how I could have access to the interceptor on that proxy, or even specify my own interceptor?
it is possible to inject your own custom interceptor. You need to provide an interceptor for the session which instantiates the objects and sets your own LazyInitializer, see here under Proxy facÂtory