Hibernate version:
1.2.1
.Net version:
1.1
Hi,
I use metaprogramming for several things like building export data, mapping imports data, audit trails, etc. To do that I've been using reflection and property introspection via type.GetProperties(), prop.GetValue(), etc.
Just recently I've added more proxies for performance reasons. For the most part everything is fine, I just call NHibernate.NHibernateUtil.GetClass(proxyObj) to get the nonProxyClass type when I need it.
The problem I'm having is with proxies representing subclasses. That is because their properties list, via type.GetProperties() is missing properties that the subclass class has got, but which aren't on the base class. So when I call prop.GetValue(proxyObj, Nothing) I'm getting an exception because the property doesn't exist on the proxied object.
In my case I'm letting the proxy override the class instead of providing an Interface. Unfortunately I can't use an Interface because the objects need to be sent over webservices, and that doesn't handle interfaces.
So, my question is, how can I work around this to get the at a proxied subclass's object property value for a property that isn't on the base class? I don't mind treating this as a special case and having a nasty work around.
I plan to work on this some more, but maybe someone else already knows the solution, or has some ideas on a direction which would prove to be fruitful. At any rate I'll update if I find anything.
|