我有一个 breeze js 导航属性,所有加载都很好,但我想刷新导航记录,所以我尝试使用以下代码
this.data().entityAspect
.loadNavigationProperty('PropertyDocuments')
.fail((reason) => alert("Data refresh failed" + reason));
这给出了错误此查询没有资源名称
刷新这个的正确方法是什么?
导航属性数据:-
?this.data().getProperty('PropertyDocuments');
__proto__: []
_addsInProcess: []
arrayChanged: {...}
length: 19
navigationProperty: {...}
parentEntity: {...}
wasLoaded: true
[0]: {...}
[1]: {...}
[2]: {...}
[3]: {...}
?this.data().getProperty('PropertyDocuments').navigationProperty
__proto__: {...}
associationName: "PropertyDocument_PropertyForSale"
entityType: {...}
entityTypeName: "PropertyDocument:#DomainModel.Models"
foreignKeyNames: []
foreignKeyNamesOnServer: []
inverse: {...}
invForeignKeyNames: [PropertyID]
invForeignKeyNamesOnServer: [PropertyID]
isScalar: false
name: "PropertyDocuments"
nameOnServer: "PropertyDocuments"
parentType: {...}
validators: []
最佳答案
这可能是由于没有与导航属性返回的 entityType 关联的“默认”资源名称造成的。 breeze 使用 resourceName 来确定要调用的 Web 服务端点。
查看此属性返回的实体类型的元数据。我的猜测是此类型的 defaultResourceName 为 null。您可以通过 MetadataStore 为任何类型设置 defaultResourceName。
var custType = em1.metadataStore.getEntityType("PropertyDocument");
custType.setProperties( {
defaultResourceName: "PropertyDocuments"
)};
另请参阅此页面上的“defaultResourceName”说明: http://www.breezejs.com/sites/all/apidocs/classes/EntityType.html
关于javascript - breezejs 导航刷新 "There is no resourceName for this query",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28754940/