Identifying NHibernate proxy classes

后端 未结 7 2026
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 06:53

I\'m not an NHibernate user; I write a serialization utility library. A user has logged a feature-request that I should handle NHibernate proxy classes, treating them the sa

7条回答
  •  遥遥无期
    2020-11-28 07:36

    NHibernate 2.1+ allows the dynamic proxy provider to be set through configuration. The implementations that I'm aware of are Castle (default), LinFu, and Spring. NHibernate does not require an interface or attribute. I think this makes it fairly impossible to reliably detect if an object is a proxy.

    As s1mm0t answered, creating the actual type on deserialization is fine.

提交回复
热议问题