Next query fails with error "Object doesn't support method 'getProperty'":

breeze.EntityQuery
   .from("Accounts")
   .expand('settlementOrganization,managementCompany')
   .using(manager).execute()

Error occurs when breeze is setting related entity managementCompany for account:

exception info from Chrome:

TypeError: undefined is not a function
    at defaultPropertyInterceptor [as _$interceptor] (breeze.debug.js:5083:49)
    at ko.computed.write (breeze.debug.js:15978:34)
    at dependentObservable [as managementCompany] (knockout-3.0.0.js:1496:31)
    at proto.setProperty (breeze.debug.js:16017:31)
    at updateRelatedEntity (breeze.debug.js:14456:26)
    at mergeRelatedEntity (breeze.debug.js:14393:13)
    at breeze.debug.js:14376:17
    at Array.forEach (native)
    at updateEntity (breeze.debug.js:14374:41)
    at mergeEntity (breeze.debug.js:14345:13)

Code in defaultPropertyInterceptor expects entity and tries to use it's method getProperty, but istead of entity we have there raw entity data (breeze.debug.js:4961).

Metadata for Account and Company types is ok. I can load companies separately and they will be set to existing accounts peacefully. But loading accounts with extend throws error.

Is it bug?

有帮助吗?

解决方案

I found the source of problem.

I'm using breeze with web api and EFContextProvider. For security purposes I added attribute Queryable above my method:

[HttpGet]
[Queryable(MaxExpansionDepth = 3)]
public IQueryable<Account> Accounts()
{
   return _contextProvider.Context.Accounts;
}

I thought that breeze won't conflict with this attribute, but when I removed attribute, everything started to work fine. Also same attribute broke inlineCount for other IQueriable source.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top