如何在breeze中清除复杂数组并向其添加对象?
因此,我有一个这样声明的对象模型:如何在breeze中清除复杂数组并向其添加对象?,breeze,Breeze,因此,我有一个这样声明的对象模型: helper.addComplexType name: "Shift" dataProperties: end_time: "int" start_time: "int" earliest_in: "int" earliest_out: "int" latest_in: "int" latest_out: "int" in_early: "bool" in_late: "bool"
helper.addComplexType
name: "Shift"
dataProperties:
end_time: "int"
start_time: "int"
earliest_in: "int"
earliest_out: "int"
latest_in: "int"
latest_out: "int"
in_early: "bool"
in_late: "bool"
out_early: "bool"
out_late: "bool"
helper.addType
name: 'DaySchedule'
apiVersion: 3
dataProperties:
uid: "uid"
employee_id: "int"
day: "string"
shifts:
complexType: "Shift"
hasMany: true
navigationProperties:
employee:
type: "Employee"
assoc: "DayScheduleEmployee"
key: ["employee_id"]
现在我有了一些代码,可以更改其中一个实体,然后将其保存回服务器
shiftType = entityManager.metadataStore.getEntityType("Shift");
shift = shiftType.createInstance
start_time: moment(@start_time).unix()
end_time: moment(@end_time).unix()
schedule.shifts.splice -1
schedule.shifts.push shift
entityManager.saveChanges()
但是,当我将其保存到服务器时,另一端的移位结果是没有数据值。这似乎来自entityManager.helper.UnwapChangedValues,它将为此复杂实体返回一个空对象。在创建这个复杂对象并将其附加到与其关联的实体时,我是否遗漏了什么
编辑:这似乎是breeze内部展开阵列的方式存在问题