Hello guys as you can see on my Title, I am wondering what is more safe and more stable to use when we are talkin about Linq to SQL, SubmitChanges() method or .Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, "entity to update"), because obliviosly we need to use them everytime we are making changes on database table, thats true?
Because in case we are not using them, we will never had updated database model in our IDE (for example visual studio).
I just started working with linq to sql and I WANT TO understand both helpers, why should I or why should not I use any of them.
Thanks guys, Cheers
The two methods do incomparable things.
SubmitChanges
writes to the database andRefresh
reads from the database.Refresh
is pretty much never needed because normally you are making all writes through entities. This means that the entities are always up to date.