我正在使用带有实体框架5的Breeze 1.4.2。这是我的查询:
var query = breeze.EntityQuery
.from("TrendStudies")
.where("Id", "==", studyId)
.expand("Charts");
如果删除.expand -part,这样可以正常工作,但是否则会失败,并显示以下错误消息:
Object #<Object> has no method 'getProperty'
显然这个错误是从微风函数抛出的:
function updateRelatedEntityInCollection(relatedEntity, relatedEntities, targetEntity, inverseProperty) {
if (!relatedEntity) return;
// check if the related entity is already hooked up
var thisEntity = relatedEntity.getProperty(inverseProperty.name);
if (thisEntity !== targetEntity) {
// if not - hook it up.
relatedEntities.push(relatedEntity);
relatedEntity.setProperty(inverseProperty.name, targetEntity);
}
}
我的相关实力只是
Object {Id: 104, TrendStudyId: 156, Order: 1, ChartClassId: 1}
那么为什么我的relatedEntity在这里缺少getProperty方法呢?它应该在某处初始化吗?