Is there a way to decompile the dynamic proxy classes that are generated by NHibernate?
I really like to know what's going on in the dynamic proxy classes that NHibernate generates.
I'm quite aware of what NHibernate dynamic proxies do on a higher level but it could d开发者_StackOverflow社区efinitely come in handy to be able to decompile them (using Reflector or something alike) during debugging sessions.
So, is there a way to decompile the dynamic proxy classes that are generated by NHibernate?
It can be done using NHibernate 3.2.0 (older version don't generate the proxies themself). Just recompile the NHibernate source with the DEBUG and DEBUG_PROXY_OUTPUT compilation symbols. NHibernate will then write the module (*.mod) and assembly (generatedAssembly.dll) files to the current directory when a proxy type is created.
If you are referering to NHibernate's collection proxy, you could just download NHibernate's source code, but if you'r referring to the dynamic proxy's nhibernate generate on runtime than I dont think you can.
Just take the assembly the classes reside in and open it with ILSpy.
In the case of dynamically generated proxies:
The also reside in an assembly. You could put some code into your program that identifies the assembly in which the generated proxy classes reside and dump it to the disk and then open it in ILSpy.
精彩评论