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
Post a Comment