问题
I'm using Breeze 1.4.2 with Entity framework 5. This is my query:
var query = breeze.EntityQuery
.from("TrendStudies")
.where("Id", "==", studyId)
.expand("Charts");
This works fine if I remove the .expand -part, but otherwise it fails with the following error message:
Object #<Object> has no method 'getProperty'
Apparently this error is thrown from the breeze function:
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);
}
}
My relatedEntity here is just
Object {Id: 104, TrendStudyId: 156, Order: 1, ChartClassId: 1}
So why is my relatedEntity missing the getProperty method here? Should it be initialized somewhere?
来源:https://stackoverflow.com/questions/19275376/breeze-expand-query-fails-with-object-object-has-no-method-getproperty