I'm talking about Collections and the Problem is following:
I need to serialize an object across a web-service and I also tried to unproxify it but that also is not working.
I tried to unproxify the object that I had just read from database using following code:
Code:
public static object Unproxy(object obj) {
if (obj is INHibernateProxy) {
LazyInitializer li = NHibernateProxyHelper.GetLazyInitializer((INHibernateProxy)obj);
obj = li.GetImplementation();
}
return obj;
}
I'm in need of serializing an object whose class is in the data model and is used by NHibernate. I can't serialize it normally because NHibernate adds to it the CastleProject DynamicProxy and the side who is deserializing the entity can't depend on the data access assemblies like NHibernate and DynamicProxy.
Is there a way of getting rid of the proxy outside of the object?
OR in other words
Can I disable the fetching of collections of Child object?
Changing properties to protected isn't working at all in my case.