I'm trying to serialize an nhibernate entity in to json but I always get this error saying Cannot serialize a Session while connected? Does it has something to do with nhibernate proxy?
Yes, this is related to lazy loading. You will need to configure NHibernate to eagerly fetch associations if you want to be able to JSON serialize it. But I would recommend you using view models instead. Ayende Rahien blogged about this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With