我发现我需要同时忽略entityAspect和的EntityType(来自自定义数据源数据源剑道片段):
this.entityManager.executeQuery(query)
.then(function (xhr) {
if (self.autoMapToJS) { // Breeze entities contain recursive properties (ugh!) - eliminate those
payload.data = ko.mapping.toJS(xhr.results, {
ignore: ['entityAspect', 'entityType']
});
} else {
payload.data = xhr.results;
}
if (self.inlineCount) {
payload.total = xhr.inlineCount;
}
options.success(payload); // notify the DataSource that the operation is complete
})
.fail(function (rejected) {
payload.error = rejected;
})
.done(); // terminate chain of promises
}
特别是,尝试使用网格(kendo),我被迫映射微风数据或享受stackoverflows,因为这些控件将迭代通过属性。
忽略entityAspect可能不够 - 恐怕还有其他递归循环。我放弃了调用jS(),但将它作为调试场景中的一个选项会很好。 – pawel
为了解决这个问题,我想在你使用toJS的时候,其他的东西会在封面上发生,因为它极其缓慢。我转而编写了一个定制的序列化程序,它的速度要快得多,但目前它很难看。当我清理它时,我会在GitHub上添加一个pull请求。 –