其中.NET JSON序列化可以与NHibernate代理对象处理? [英] Which .NET JSON serializers can deal with NHibernate proxy objects?
问题描述
这.NET JSON序列化可以与NHibernate代理对象处理?我尝试使用JSON.NET但胡扯出来,当它击中一个代理的对象。
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.
推荐答案
我会说,最好的办法是将处理代理对象,而不是真正找到另一种方式来连载JSON。我已经回答了涉及急于返回无论是正确的对象或null <一个旧的数据库加载这些代理对象另一个问题href="http://stackoverflow.com/questions/435342/unexpected-proxy-objects-in-nhibernate-with-composite-ids/1030590#1030590">here.另请注意,用正确的数据库设置与外键和对象/表之间的明确联系,你不应该遇到任何代理对象。还要注意的是,这不是什么需要流利的NHibernate的,我假设你正在使用单独的HBM映射文件。
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.
祝你好运!
这篇关于其中.NET JSON序列化可以与NHibernate代理对象处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!