清风获取元数据如果没有present [英] breeze fetch meta data if not present

查看:184
本文介绍了清风获取元数据如果没有present的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个角/微风/应用的WebAPI,除非我刷新具有EntityQuery返回一个实体一个网页,其中的伟大工程。然后,它抱怨说,元数据不作为的entityquery不会触发元数据提取,不像标准的查询。

I have an angular / breeze / webapi app which works great except if I refresh a page which has a EntityQuery to return one entity. It then complains that the metadata is not available as the entityquery does not trigger a metadata fetch, unlike a standard query.

如果我们已经达到从previous角度页面已经发射了标准的微风查询的页面则元数据已经存在,我们没有任何问题。

If we have reached the page from a previous angular page which has fired a standard breeze query then the metadata is already there and we have no problem.

所以问题是,我该如何检查元数据是否存在,并触发调用的元数据,如果它尚未?

任何帮助,非常感谢你给我的。

Many thanks for any help you can give me.

推荐答案

尝试是这样的:

function fetchMetadata() {
    var manager = new breeze.EntityManager("api/breeze");
    if (manager.metadataStore.isEmpty()) {
        return manager.fetchMetadata();
    }

    return Q.resolve();
}

function start() {
     fetchMetadata().then(function () {
            // Metadata fetched.
            // Do something here.
     });
}

这篇关于清风获取元数据如果没有present的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆