heweitykc / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
0 stars 0 forks source link

NHibernate Proxy Detection fails in some cases ( Different Proxy Interface ) #240

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Proxy detection ignores some NHibernate proxies

What steps will reproduce the problem?
1. I haven't quite found out yet when NHibernate uses specific types of 
proxies, but i've inspected the interfaces on the classes that failed.

Currently the TypeModel.ResolveProxies method only checks for
NHibernate.Proxy.INHibernateProxy, but the proxy that was on my instance was 
actually an NHibernate.Intercept.IFieldInterceptorAccessor.
Both classes also had the Interface NHibernate.Proxy.DynamicProxy.IProxy 
listed, so maybe that's a new common root proxy interface.

For now i'm just checking all three interfaces to make it work here.

                if(interfaces[i].FullName == "NHibernate.Proxy.INHibernateProxy") return type.BaseType;
                if(interfaces[i].FullName == "NHibernate.Proxy.DynamicProxy.IProxy") return type.BaseType;
                if(interfaces[i].FullName == "NHibernate.Intercept.IFieldInterceptorAccessor") return type.BaseType;

Original issue reported on code.google.com by ANeumann...@googlemail.com on 14 Oct 2011 at 1:27

GoogleCodeExporter commented 9 years ago
Thanks for the extra detail - I don't know if this is new, or just some 
specialized case, but I will change this for the next build.

Original comment by marc.gravell on 14 Oct 2011 at 5:21

GoogleCodeExporter commented 9 years ago

Original comment by marc.gravell on 14 Oct 2011 at 5:29