简体   繁体   English

Breeze.js loadNavigationProperty与expand

[英]Breeze.js loadNavigationProperty with expand

Is it possbible to call loadNavigationProperty with expanding the entities? 通过扩展实体可以调用loadNavigationProperty吗? Something like: 就像是:

myGarage.entityAspect.loadNavigationProperty('car.wheels');

Or is this only possible with a new query? 还是只有新查询才有可能?

You can only use loadNavigationProperty with immediate nav properties (ie myGarage.car). 您只能将loadNavigationProperty与直接的nav属性(即myGarage.car)一起使用。

We'll update our documentation so there is no confusion. 我们将更新文档,以免造成混乱。

Based on breeze source: 基于微风来源:

    function loadNavigationalProperty(entity, propertyName, forceReload, expand) {
        if (forceReload || !entity.entityAspect.isNavigationPropertyLoaded(propertyName)) {
            var navProperty = entity.entityType._checkNavProperty(propertyName);
            var query = breeze.EntityQuery.fromEntityNavigation(entity, navProperty);
            if (expand) query = query.expand(expand);
            return manager.executeQuery(query).catch(queryFailed);
        } 
        return $q.resolve({ results: entity[propertyName] });
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM