Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subsonic 3 .Save() VS .Update() and .Add()

Tags:

subsonic

What is the difference between: .Save();
.Add(); .Update():

like image 457
Shuaib Avatar asked Nov 22 '25 08:11

Shuaib


1 Answers

You don't mention which templates you're using (I'm going to assume ActiveRecord), but as a general rule:

  • Save will insert if the object IsNew==true or otherwise it will update.
  • Add will always insert a new record.
  • Update will only update an object with IsNew==false and will fail if there is no corresponding record in the db for the instance.
like image 193
John Sheehan Avatar answered Nov 24 '25 23:11

John Sheehan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!