Breeze expand query fails with Object #<Object> has no method 'getProperty'

只愿长相守 提交于 2019-12-23 04:03:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!