Domanda

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 .

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top