We are currently developing a small Hmtl/ JavaScript application with breeze.js (Version 1.3.4). We configured to used OData protocol to query the entities.
With a simple entity it just works fine. If we are querying a complex entity (contact entity with two complex type properties for phone numbers and addresses), we receive the following error:
"TypeError: Cannot call method '_createInstanceCore' of null
at ctor.startTracking (<ServerAddress>/scripts/breeze.debug.js:14086:49)
at Array.forEach (native)
at ctor.startTracking (<ServerAddress>1/scripts/breeze.debug.js:14069:12)
at new ctor <ServerAddress>/scripts/breeze.debug.js:2952:52)
at proto._createEntityCore (<ServerAddress>1/scripts/breeze.debug.js:6478:9)
at mergeEntity <ServerAddress>/scripts/breeze.debug.js:12458:39)
at processMeta (<ServerAddress>/scripts/breeze.debug.js:12381:24)
at visitAndMerge (<ServerAddress>/scripts/breeze.debug.js:12361:16)
at <ServerAddress>/scripts/breeze.debug.js:12316:33
at Array.map (native)
From previous event:
at executeQueryCore (<ServerAddress>/scripts/breeze.debug.js:12290:77)
at proto.executeQuery (<ServerAddress>/scripts/breeze.debug.js:11243:23)
at DataContext.executeCachedQuery (<ServerAddress>/App/services/datacontext.js:138:33)
at DataContext.getContactsBySearchParams (<ServerAddress>/App/services/datacontext.js:111:25)
at Search.searchCmd.ko.asyncCommand.execute (<ServerAddress>/App/viewmodels/search.js:34:38)
at Search.ko.asyncCommand.self.execute (<ServerAddress>/scripts/knockout.command.js:57:29)
at HTMLButtonElement.ko.bindingHandlers.event.init (<ServerAddress>/scripts/knockout-2.2.1.debug.js:2318:66)"
While debugging the code, we see, that the dataType field of the complex property instance is null:
val = prop.dataType._createInstanceCore(entity, prop.name);
We can also see that the complexTypeName has a strange value formatting like:
<ComplexTypeName>):#<NameSpace>
Another thing we noticed concerning the strange complex type name is, that the entities property is a collection of complex types (a contact may have multiple addresses). The check on Line 14085 always returns isScalar = true, but a complex array should be created instead.
Is there a problem with the OData Metadata for complex types? How could we solve this issue?
Thank you in advance for your answer.
Cheers, Marc