✅ EfCore Question: Calling .SaveChanges() between a .Remove() and .Add()
Using efcore 6....if im doing a .Remove() and then a .Add(), do I need to call .SaveChanges() in between?
So
.Remove()
.SaveChanges()
.Add()
.SaveChanges()
or can I skip the .SaveChanges() between add and remove, and just do
.Remove()
.Add()
.SaveChanges()
?
Thx!
3 Replies
You can do the second.
Ef core has excellent entity tracking
got it. thank you. i saw it combined it into an update statement, rather than 2 statements, delete and insert. so i guess it's smart enough to automagically sort things out.
You can
/close
the thread if you don't have any further questions.