简体   繁体   中英

How do i get the the full name of the proxyed type for a nhibernate DynamicProxy?

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. ie 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.

您可以将代理转换为INHibernateProxy并获取持久性基础类:

((INHibernateProxy)proxy).HibernateLazyInitializer.PersistentClass

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM