我有一个breeze-js导航属性,所有加载都很好,但我想刷新导航记录,所以我尝试使用以下代码
this.data().entityAspect
.loadNavigationProperty('PropertyDocuments')
.fail((reason) => alert("Data refresh failed" + reason));
这会产生错误此查询没有resourceName
刷新此项的正确方法是什么?
导航属性数据:-
?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关联的"默认"资源名称造成的。resourceName由breeze用于确定要调用的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