Sql ON UPDATE CASCADE
option for foreign keys was the simplest solution !
how to update a primary key that is also a foreign key in another table with petapoco?
-
07-10-2022 - |
Question
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 .
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow