views:

146

answers:

1

I am using a netdatacontractserializer and a SerializationBinder to create my own runtime types for nhibernate proxies on the client side.

This all works except I am forced to assume that there is only one type by each name in the domain model. i.e. i am forced to ignore the namespace. The reason is that SerializationBinder only gives me access to "MyObjectProxyb04bae2d04d34e8a98b1d93bf24428cc" and "DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" to derive the parent tyep.

As you can see there is no data that points to the namespace of the parent type.

I have had a look at changing the name of the generated proxy (to include a namespace prefix) but that seems to be hard coded.

+1  A: 

You can cast the proxy to INHibernateProxy and get the persistent underlying class:

((INHibernateProxy)proxy).HibernateLazyInitializer.PersistentClass
Mauricio Scheffer
how do i do this on the client side after serialization.
Simon
Don't know anything about SerializationBinder, I'm just answering your nhibernate-proxying question.
Mauricio Scheffer