问题
Breeze cannot create entities. It does the query for Metadata (which is in my Controller class) and it returns data with a 200 code. Then it queries the data, and returns with a 200 code. Both sets of return data appear to be json format on the surface.
Looking further into the Metadata, it appears to be json serializing the xml metadata. This does not feel right to me - and on the live example on the breeze site, does not appear to be doing this.
Anyone have any tips on what might be causing this? Here is how the metadata starts:
"{\"?xml\":{\"version\":\"1.0\",\"encoding\":\"utf-8\"},\"schema\":{\"namespace\":
When the service returns data, I get an error, with the full & correct json response. The internalError reports "Unable to get property 'createCtor' of undefined or null reference"
It gets to this line in the mergeEntity function, when I debug breeze.js:
targetEntity = entityType._createEntityCore();
Then in the ctr.prototype.getEntityCtor function - it fails to get the entity's constructor from the metadataStore's _typeRegistry property using this line:
var aCtor = typeRegistry[this.name] || typeRegistry[this.shortName];
after that, the error is thrown and we end up in the catch of the executeQuery function.
回答1:
The issue I was having should have been obvious. My bundling configuration was not including knockout scripts after the scripts have been updated. Be sure that you have a binding library loaded (and it's loading properly) if you experience this issue.
来源:https://stackoverflow.com/questions/14494117/breeze-metadata-appears-in-xml-format