I work in Durandal-project and use Breeze objects.
I have breeze model that contain some complex-types.
At server side, I set some of the complex-type properties to be null.
But, when object arrives to client-side, the complex-types which I have set to be null - contain referance to object of complex-type. I need them to be null.
my main model pattern:
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);
}
server side code (c#, using apiController):
if (!EnablJobsData)
employeeData.employeeJobsData = null;
I want that when the condition is true, so at client side employeeData.employeeJobsData() - returns null. Actuality, it returns breeze complex-entity.
Thanks!