I know the same question has been asked here. However, that answer doesn't solve my problem, because in my project, I don't specify "hasServerMetadata: false". Actually, most of time, I don't get this error.
This error occurs when I try to create a new student (first time okay), and while still in the editing mode, if I click browser's refresh button, I get this error. If I edit an existing student, I don't have this problem.
My project is basically based on Breeze/Angular SPA ToDo template.
Here are some related codes.
Model:
public class Student
{
public int Id { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
[ForeignKey("ContactInfo")]
public int ContactInfoId { get; set; }
public ContactInfo ContactInfo { get; set; }
}
public class ContactInfo
{
public int Id { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public string ZipCode { get; set; }
}
datacontext.js:
function createStudent() {
var student = manager.createEntity("Student", { createdOn: new Date() });
student.contactInfo = manager.createEntity("ContactInfo");
student.contactInfo.state = "TX";
return student;
}