在以下微风例程中发现了一个小错误:protoFn.startTracking
我并不感到惊讶,你之前没见过它,因为它是一个例外:
prop.Name
应该是
propName or prop.name
以下是例程的其余部分,以便您可以找到它。
// entity is either an entity or a complexObject
protoFn.startTracking = function (entity, proto) {
// can't touch the normal property sets within this method - access the backingStore directly instead.
var bs = movePropsToBackingStore(entity);
console.log(' ', entity, ' ', proto);
// assign default values to the entity
var stype = entity.entityType || entity.complexType;
stype.getProperties().forEach(function (prop) {
console.log(' ', entity, ' ', prop);
var propName = prop.name;
var val = entity[propName];
console.log(' ', propName, ' ', val);
if (prop.isDataProperty) {
if (prop.isComplexProperty) {
if (prop.isScalar) {
val = prop.dataType._createInstanceCore(entity, prop);
} else {
val = breeze.makeComplexArray([], entity, prop);
}
} else if (!prop.isScalar) {
val = breeze.makePrimitiveArray([], entity, prop);
} else if (val === undefined) {
val = prop.defaultValue;
}
} else if (prop.isNavigationProperty) {
if (val !== undefined) {
throw new Error("Cannot assign a navigation property in an entity ctor.: " + prop.Name);
}
Best Niels