I have upgraded to the latest breeze version and now in`
function movePropsToBackingStore(instance) {
var bs = getBackingStore(instance);
var proto = Object.getPrototypeOf(instance);
var stype = proto.entityType || proto.complexType;
stype.getProperties().forEach(function(prop) {
var propName = prop.name;
if (!instance.hasOwnProperty(propName)) return;
// pulls off the value, removes the instance property and then rewrites it via ES5 accessor
var value = instance[propName];
delete instance[propName];
instance[propName] = value;
});
return bs;
}
i am getting exceptions in which - cannot delete properties in strict mode!!! for some of my entities i have registered CTORS with computed properties
is there a work around or is it a bug?
example of ctor
define(['sharedServices/dataRepository', 'sharedServices/enumRepository'], function (dataRepository, enumRepository) {
'use strict';
return function () {
this.segments = undefined;
var that = this;
function isArray(value) {
return value &&
typeof value === 'object' &&
typeof value.length === 'number' &&
typeof value.splice === 'function' &&
!(value.propertyIsEnumerable('length'));
}
function handlePropertySet(entityName, newState) {
if ((isArray(newState) && newState.length === 0) || (!isArray(newState) && !newState.results)) {
return;
}
var i = 0,
value = isArray(newState) ? newState : newState.results;
for (i; i < value.length; i++) {
dataRepository.addUnchangedEntity(entityName, value[i]);
}
}
function handlePropertyGet(enstate, ename) {
if (that[enstate] === undefined || that[enstate] === null) {
if (!that.entityAspect || !that.entityAspect.entityManager || !that.entityAspect.entityManager.isReady) {
that[enstate] = null;
} else {
that[enstate] = that.entityAspect.entityManager.executeQueryLocally(new breeze.EntityQuery(ename).
where('VirtualTourID', 'eq', that.ID));
}
}
return that[enstate] === null ? [] : that[enstate];
}
Object.defineProperty(this, 'Segments', {
get: function () {
return handlePropertyGet('segments', "VirtualTourSegments");
},
set: function (value) { //used only when loading tours from the server
handlePropertySet('CVirtualTourSegment', value);
},
enumerable: true
});
};
});
i get error when deleting Segments also I am using IE11