我试图从微风查询中获取inlinecount。结果将返回,但inlineCount属性将是未定义的。我捕获了微风查询并导致了Fiddler,它们似乎是正确的。服务器返回Fiddler中的值,并在count参数中添加了json结果。我用自己的应用程序获得了相同的结果。
// Get all TodoItems from the server and cache combined
function getAllTodoItems() {
// Create the query
var query = breeze.EntityQuery.from('TodoItem')
.inlineCount();
// Execute the query
return manager.executeQuery(query)
.then(success).catch(queryFailed);
function success(data){
// Interested in what server has then we are done.
var fetched = data.results;
$log.log('breeze query succeeded. fetched: '+ fetched.length);
// Blended results.
// This gets me all local changes and what the server game me.
return manager.getEntities(todoItemType);
// Normally would re-query the cache to combine cached and fetched
// but need the deleted entities too for this UI.
// For demo, we returned every cached Todo
// Warning: the cache will accumulate entities that
// have been deleted by other users until it is entirely rebuilt via 'refresh'
}
}
答案 0 :(得分:1)
如果使用inlineCount
装饰WebApi Get方法,或者使用BreezeQueryableAttribute
装饰WebApi控制器,则Breeze将添加BreezeControllerAttribute
属性。否则,您可以通过拨打data.httpResponse.data.count
来获取计数。
您可以通过启动WebApi服务器并在config.js文件中将uzeZumo
变量设置为false来在todo示例中证明这一点。这将从WebApi中获取记录。默认情况下,它会从Zumo中获取数据。
希望这有帮助。