Following multiple articles like
http://ayende.com/Blog/archive/2009/08/07/nhibernate-amp-inotifypropertychanged.aspx,
I've implemented a mechanism to provide INotifyPropertyChanged support
for entities using Castle proxies. I've implemented this by providing
an ProxyFactoryFactory, an EmptyInterceptor (like the article
describes) and one for creating new entities.

The problem I encounter using this implementation is that Linq does
not work. It looks like this is the same issue as described in "Proxy
with lazy fields does not implement INHibernateProxy" (http://
groups.google.com/group/nhibernate-development/browse_thread/thread/
7cb02cd20c5593e1).

Aside from not being able to unproxy such entities, I understand that
NHibernate has problems getting the actual type of the proxy. When the
proxy implements INHibernateProxy, there is an interface to retrieve
the PersistentClss, but as far as I can see,
NHibernateProxyHelper.GetClassWithoutInitializingProxy only checks for
this interface.

Is it an option to provide an interface which can be implemented by
proxies which cannot implement INHibernateProxy and let this interface
provide the actual type of the proxied entity?
NHibernateProxyHelper.GetClassWithoutInitializingProxy and others
could then also check for this interface and provide the type reported
through this interface.

Reply via email to