Hibernate version: 1.0.2
My entities are mapped as lazy and use field access. When an entity is proxied, after the proxy is initialized, the fields in my entity's class that back its properties are still null! Checking with the Visual Studio debugger, my property getters & setters are never entered. Apparently proxies keep their own storage!
This appears to be a MAJOR problem. We have logic (mostly in the setters, but even some in getters) that must execute. Shouldn't the proxies simply lazyload when the proxy is unitialized, and then just call the base getter/setter? I.e. I expected proxy properties to be nothing more than this:
Code:
public override SomeType SomeProperty
{
get
{
if (!NHibernateUtil.IsInitialized(this)) NHibernateUtil.Initialize(this);
return base.SomeProperty;
}
set
{
if (!NHibernateUtil.IsInitialized(this)) NHibernateUtil.Initialize(this);
base.SomeProperty = value;
}
}