在不同的订单中完成附加navigationProperties时出错

时间:2014-06-11 21:10:17

标签: breeze

所以我有三种实体类型:

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"]

addType
name: 'Employee'
dataProperties:
  id: "id"
  details:
    complexType: "EmployeeDetails"
navigationProperties:
  schedules:
    entityTypeName: "DaySchedule"
    hasMany: true
    associationName: "DayScheduleEmployee"
  attendanceDays:
    entityTypeName: "AttendanceDay"
    hasMany: true
    associationName: "AttendanceDayEmployee"

apiSchemaHelper.addType
name: "AttendanceDay"
apiVersion: 3
dataProperties:
  uid: "uid"
  employee_id: "int"
  date: "string"
  shifts:
    complexType: "AttendanceShift"
    hasMany: true
navigationProperties:
  employee:
    type: "Employee"
    assoc: "AttendanceDayEmployee"
    key: ["employee_id"]

如您所见,员工拥有许多DaySchedule和AttendanceDay对象。

如果按以下顺序创建此类型的三个对象:

employee = createEntity "Employee", id: 20
daySchedule = createEntity "DaySchedule", employee_id: 20
attendanceDay = createEntity "AttendanceDay", employee_id: 20

然后正确制作所有navigationProperties。 但是,如果我将员工创建放在最后:

daySchedule = createEntity "DaySchedule", employee_id: 20
attendanceDay = createEntity "AttendanceDay", employee_id: 20
employee = createEntity "Employee", id: 20

然后employee.schedules正如预期的那样,但employee.attendanceDays是一个空数组。

1 个答案:

答案 0 :(得分:0)

好的,这是一个bug,现在修复了breeze.js GitHub repo。这个修复程序也将在下周的某个时候出现在下一个完整的breeze.js版本(1.4.14)中。