Breeze BeforeSaveEntity create new entity for foreign key -


when i'll try create new timeslot want add userid. save all, userid new 1 , code create new user instead of set foreign key.

during debug user.id correct , timeslot.user.id correct.

protected override bool beforesaveentity(entityinfo entityinfo)         {             // return false if don’t want entity saved.             if (entityinfo.entity.gettype() == typeof(timeslot)                 && entityinfo.entitystate == entitystate.added)             {                 var timeslot = (timeslot)entityinfo.entity;                 var user = uow.users.getbyid(userid);                 timeslot.user = user;                 return true;             }             else             {                 return true;             }         } 


Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -