문제

public class User {
   public int Id {get;set;}
}
public class Phone {
   public int Id{get;set}
   public int UserId{get;set;} // foreign key
}

How can i update a User.Id property with PetaPoco ? user.Update("set id = @NewId where id = @OldId",new { NewId = new_id,OldId = id}); Did not work .

도움이 되었습니까?

해결책

Sql ON UPDATE CASCADE option for foreign keys was the simplest solution !

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top