I am using the Angular/Breeze SPA template in visual studio 2012. I have added an unmapped property in the TodoList server model.
[NotMapped]
public string MyUnmappedProperty{ get{return "testString";}}
I have registered the unmapped property in the constructor on the client model, specifically in the todo.model.js like Ward suggested here : Handling calculated properties with breezejs and web api
function TodoList() {
this.title = "My todos"; // defaults
this.userId = "to be replaced";
this.myUnmappedProperty="";
}
When the getTodos() method is called on the todo.controller.js for the first time, the "myUnmappedProperty" has the value of the empty string as set in the constructor. Only after getTodos() is called for the second time( I have added a button that does that) with 'forceRefresh' set to true (getTodos(true)) in order to query the server, only then I see the myUnmappedProperty getting the value "testString".
I am wondering why I am getting this behaviour. Is it possible to have the unmapped property filled with the server value the first time the getTodos() is called?
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…