Breezejs ZUMO示例将inlineCount返回为undefined

时间:2014-05-19 13:30:02

标签: breeze azure-mobile-services

我试图从微风查询中获取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'
        }
    }

1 个答案:

答案 0 :(得分:1)

如果使用inlineCount装饰WebApi Get方法,或者使用BreezeQueryableAttribute装饰WebApi控制器,则Breeze将添加BreezeControllerAttribute属性。否则,您可以通过拨打data.httpResponse.data.count来获取计数。

您可以通过启动WebApi服务器并在config.js文件中将uzeZumo变量设置为false来在todo示例中证明这一点。这将从WebApi中获取记录。默认情况下,它会从Zumo中获取数据。

希望这有帮助。