1

Which .NET JSON serializers can deal with NHibernate proxy objects? I tried using JSON.NET but it craps out when it hits a proxied object.

1

1 Answer 1

1

I would say that the best idea would be to deal with the proxy objects rather than actually find another way to serialise JSON. I have answered another question which involves eager loading these proxy objects in a legacy database which returns either the correct object or null here. Please also note that with the proper database set up with foreign keys and definite links between objects/tables you shouldn't run into any proxy objects. Also note that this is not what is required for fluent NHibernate, I am assuming that you are using separate hbm mapping files.

Good luck!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I realize now that even though I can fix it in Json.NET, the fact that NHibernate proxy objects plays bad with reflection (specifically GetType()) is game-killing considering how many tools use reflection to work their magic. Also, I have a proper object graph; the proxy objects is due to lazy loading.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.