【发布时间】:2014-07-30 04:02:52
【问题描述】:
我在 Durandal 项目中工作并使用 Breeze 对象。
我有一个包含一些复杂类型的微风模型。
在服务器端,我将一些复杂类型的属性设置为 null。
但是,当对象到达客户端时,我设置为 null 的复杂类型包含对复杂类型对象的引用。 我需要它们为空。
我的主要模型模式:
function addEmployeeType(store) {
store.addEntityType({
shortName: "EmployeeDTO",
namespace: "myServer.Entities",
autoGeneratedKeyType: AutoGeneratedKeyType.Identity,
dataProperties: {
Emp_no1: { dataType: DataType.Int32, isNullable: false, isPartOfKey: true },
employeeBaseData: {
name: "employeeBaseData",
complexTypeName: "EmployeeBaseDTO:#myServer.Entities",
isNullable: false,
isPartOfKey: false
},
employeeTblData: {
name: "employeeTblData",
complexTypeName: "EmployeeTblDTO:#myServer.Entities",
isNullable: false
},
employeePersonalDetails: {
name: "employeePersonalDetails",
complexTypeName: "EmployeePersonalDetailsDTO:#myServer.Entities",
isNullable: true
},
employeeContacts: {
name: "EmployeeJobsDTO",
complexTypeName: "EmployeeJobsDTO:#myServer.Entities",
isNullable: true
}
}
});
store.registerEntityTypeCtor("EmployeeDTO", null, employeeInit);
}
服务器端代码(c#,使用apiController):
if (!EnablJobsData)
employeeData.employeeJobsData = null;
我希望当条件为真时,所以在客户端employeeData.employeeJobsData() - 返回null。 实际上,它返回的是微风复杂实体。
谢谢!
【问题讨论】:
标签: c# breeze asp.net-apicontroller